{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ea858e48",
   "metadata": {},
   "source": [
    "* 日期：2023-03-01\\\\ week02（周三）  \n",
    "* 课程：Python-data-analysis-couse  \n",
    "* 记录人：黄斐珍 "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a186940",
   "metadata": {},
   "source": [
    "## 常用基本函数  \n",
    "* 1.汇总函数  \n",
    "* 2.特征统计函数  \n",
    "* 3.唯一值函数  \n",
    "* 4.替换函数  \n",
    "* 5.排序函数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b45f3065",
   "metadata": {},
   "source": [
    "# series "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "6e791199",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "my_idx\n",
       "1           100\n",
       "2             a\n",
       "3    {dict1, 5}\n",
       "Name: my_name, dtype: object"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = pd.Series(\n",
    "    data = [100,'a',{'dict1',5}],\n",
    "    index = pd.Index([1,2,3],name='my_idx'),\n",
    "    dtype = 'object',\n",
    "    name = 'my_name'\n",
    "             )\n",
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "67512529",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "学科\n",
       "数学    67\n",
       "语文    78\n",
       "英语    75\n",
       "dtype: int64"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1 = pd.Series(\n",
    "    data = [67,78,75],\n",
    "    index = pd.Index(['数学','语文','英语'],name='学科')\n",
    ")\n",
    "s1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "18c272dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([67, 78, 75], dtype=int64)"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "4b9840d7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['数学', '语文', '英语'], dtype='object', name='学科')"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "e2d0f0b2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('int64')"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "4e8764dd",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1.name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "ed60c5c3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3,)"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "c1e7d45c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    67\n",
       "1    78\n",
       "2    75\n",
       "dtype: int64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s2 = pd.Series(\n",
    "    data = [67,78,75],\n",
    ")\n",
    "s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "3ba95197",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "67"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s2[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7c315613",
   "metadata": {},
   "source": [
    "# DataFrame  \n",
    "* 具有相同特征和个数的列表数据的集合，可以用DataFrame来描述"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "314b9387",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = [\n",
    "    [1, 'a', 1.2],\n",
    "    [2, 'b', 2.2], \n",
    "    [3, 'c', 3.2]\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "bdd6c828",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>col_0</th>\n",
       "      <th>col_1</th>\n",
       "      <th>col_2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>row_0</th>\n",
       "      <td>1</td>\n",
       "      <td>a</td>\n",
       "      <td>1.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>row_1</th>\n",
       "      <td>2</td>\n",
       "      <td>b</td>\n",
       "      <td>2.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>row_2</th>\n",
       "      <td>3</td>\n",
       "      <td>c</td>\n",
       "      <td>3.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       col_0 col_1  col_2\n",
       "row_0      1     a    1.2\n",
       "row_1      2     b    2.2\n",
       "row_2      3     c    3.2"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(\n",
    "    data = data,\n",
    "    index = ['row_0','row_1','row_2'],\n",
    "    columns = ['col_0','col_1','col_2']\n",
    ")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "813e101d",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = {\n",
    "    'col_0':[1,2,3],\n",
    "    'col_1':['a','b','c'],\n",
    "    'col_2':[1.2,2.2,3.2]\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "48e73e4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>col_0</th>\n",
       "      <th>col_1</th>\n",
       "      <th>col_2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>row_0</th>\n",
       "      <td>1</td>\n",
       "      <td>a</td>\n",
       "      <td>1.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>row_1</th>\n",
       "      <td>2</td>\n",
       "      <td>b</td>\n",
       "      <td>2.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>row_2</th>\n",
       "      <td>3</td>\n",
       "      <td>c</td>\n",
       "      <td>3.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       col_0 col_1  col_2\n",
       "row_0      1     a    1.2\n",
       "row_1      2     b    2.2\n",
       "row_2      3     c    3.2"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(\n",
    "    data = data,\n",
    "    index = ['row_0','row_1','row_2']\n",
    ")\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ec4ef0db",
   "metadata": {},
   "source": [
    "# DataFrame 取值的一般方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "30cd02ea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "row_0    1\n",
       "row_1    2\n",
       "row_2    3\n",
       "Name: col_0, dtype: int64"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['col_0']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "7fbcc594",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>col_0</th>\n",
       "      <th>col_2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>row_0</th>\n",
       "      <td>1</td>\n",
       "      <td>1.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>row_1</th>\n",
       "      <td>2</td>\n",
       "      <td>2.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>row_2</th>\n",
       "      <td>3</td>\n",
       "      <td>3.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       col_0  col_2\n",
       "row_0      1    1.2\n",
       "row_1      2    2.2\n",
       "row_2      3    3.2"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['col_0','col_2']]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "465a3b77",
   "metadata": {},
   "source": [
    "* iloc ：强大的切片取值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "dcc8a9c2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>col_1</th>\n",
       "      <th>col_2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>row_1</th>\n",
       "      <td>b</td>\n",
       "      <td>2.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>row_2</th>\n",
       "      <td>c</td>\n",
       "      <td>3.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      col_1  col_2\n",
       "row_1     b    2.2\n",
       "row_2     c    3.2"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.iloc[1:3,1:3]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cb80c281",
   "metadata": {},
   "source": [
    "### 课后练习(参考 pandas cheat sheet)：\n",
    "> 1.iloc 2.loc 3.iat 4.at"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "7e237491",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 'a', 1.2],\n",
       "       [2, 'b', 2.2],\n",
       "       [3, 'c', 3.2]], dtype=object)"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "6cf66184",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['row_0', 'row_1', 'row_2'], dtype='object')"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "fbff2089",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['col_0', 'col_1', 'col_2'], dtype='object')"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c95caa8",
   "metadata": {},
   "source": [
    "# 常用基本函数  \n",
    "\n",
    "1.汇总函数  \n",
    "2.特征统计函数  \n",
    "3.唯一值函数  \n",
    "4.替换函数  \n",
    "5.排序函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "3533a1f9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "0    Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1                Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2    Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3                 Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4                 Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "..                             ...        ...             ...     ...     ...   \n",
       "195               Fudan University     Junior    Xiaojuan Sun  Female   153.9   \n",
       "196            Tsinghua University     Senior         Li Zhao  Female   160.9   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "199            Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "0      46.0        N            1   2019/10/5     0:04:34  \n",
       "1      70.0        N            1    2019/9/4     0:04:20  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "3      41.0        N            2    2020/1/3     0:04:08  \n",
       "4      74.0        N            2   2019/11/6     0:05:22  \n",
       "..      ...      ...          ...         ...         ...  \n",
       "195    46.0        N            2  2019/10/17     0:04:31  \n",
       "196    50.0        N            3   2019/9/22     0:04:03  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  \n",
       "199    51.0        N            1   2019/11/6     0:05:05  \n",
       "\n",
       "[200 rows x 10 columns]"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('data/learn_pandas.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "012436d1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['School', 'Grade', 'Name', 'Gender', 'Height', 'Weight', 'Transfer',\n",
       "       'Test_Number', 'Test_Date', 'Time_Record'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "ef9465c0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "               Name  Height  Weight\n",
       "0      Gaopeng Yang   158.9    46.0\n",
       "1    Changqiang You   166.5    70.0\n",
       "2           Mei Sun   188.9    89.0\n",
       "3      Xiaojuan Sun     NaN    41.0\n",
       "4       Gaojuan You   174.0    74.0\n",
       "..              ...     ...     ...\n",
       "195    Xiaojuan Sun   153.9    46.0\n",
       "196         Li Zhao   160.9    50.0\n",
       "197  Chengqiang Chu   153.9    45.0\n",
       "198   Chengmei Shen   175.3    71.0\n",
       "199     Chunpeng Lv   155.7    51.0\n",
       "\n",
       "[200 rows x 3 columns]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['Name','Height','Weight']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "fe10dd5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          School      Grade            Name  Gender  Height  \\\n",
       "0  Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1              Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2  Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3               Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4               Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "\n",
       "   Weight Transfer  Test_Number  Test_Date Time_Record  \n",
       "0    46.0        N            1  2019/10/5     0:04:34  \n",
       "1    70.0        N            1   2019/9/4     0:04:20  \n",
       "2    89.0        N            2  2019/9/12     0:05:22  \n",
       "3    41.0        N            2   2020/1/3     0:04:08  \n",
       "4    74.0        N            2  2019/11/6     0:05:22  "
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "49589658",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 200 entries, 0 to 199\n",
      "Data columns (total 10 columns):\n",
      " #   Column       Non-Null Count  Dtype  \n",
      "---  ------       --------------  -----  \n",
      " 0   School       200 non-null    object \n",
      " 1   Grade        200 non-null    object \n",
      " 2   Name         200 non-null    object \n",
      " 3   Gender       200 non-null    object \n",
      " 4   Height       183 non-null    float64\n",
      " 5   Weight       189 non-null    float64\n",
      " 6   Transfer     188 non-null    object \n",
      " 7   Test_Number  200 non-null    int64  \n",
      " 8   Test_Date    200 non-null    object \n",
      " 9   Time_Record  200 non-null    object \n",
      "dtypes: float64(2), int64(1), object(7)\n",
      "memory usage: 15.8+ KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "21e828c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Test_Number</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>183.000000</td>\n",
       "      <td>189.000000</td>\n",
       "      <td>200.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>163.218033</td>\n",
       "      <td>55.015873</td>\n",
       "      <td>1.645000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>8.608879</td>\n",
       "      <td>12.824294</td>\n",
       "      <td>0.722207</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>145.400000</td>\n",
       "      <td>34.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>157.150000</td>\n",
       "      <td>46.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>161.900000</td>\n",
       "      <td>51.000000</td>\n",
       "      <td>1.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>167.500000</td>\n",
       "      <td>65.000000</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>193.900000</td>\n",
       "      <td>89.000000</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Height      Weight  Test_Number\n",
       "count  183.000000  189.000000   200.000000\n",
       "mean   163.218033   55.015873     1.645000\n",
       "std      8.608879   12.824294     0.722207\n",
       "min    145.400000   34.000000     1.000000\n",
       "25%    157.150000   46.000000     1.000000\n",
       "50%    161.900000   51.000000     1.500000\n",
       "75%    167.500000   65.000000     2.000000\n",
       "max    193.900000   89.000000     3.000000"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2c43edcf",
   "metadata": {},
   "source": [
    "# 特征统计函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "e732eeb8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Height  Weight\n",
       "0     158.9    46.0\n",
       "1     166.5    70.0\n",
       "2     188.9    89.0\n",
       "3       NaN    41.0\n",
       "4     174.0    74.0\n",
       "..      ...     ...\n",
       "195   153.9    46.0\n",
       "196   160.9    50.0\n",
       "197   153.9    45.0\n",
       "198   175.3    71.0\n",
       "199   155.7    51.0\n",
       "\n",
       "[200 rows x 2 columns]"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo = df[['Height','Weight']]\n",
    "df_demo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "f01b00ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Height    163.218033\n",
       "Weight     55.015873\n",
       "dtype: float64"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo.mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "4e39b6c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Height    183\n",
       "Weight    189\n",
       "dtype: int64"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo.count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "a221202f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Height    193\n",
       "Weight      2\n",
       "dtype: int64"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo.idxmax()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5b626631",
   "metadata": {},
   "source": [
    "# 唯一值函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "89b9d46b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "0    Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1                Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2    Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3                 Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4                 Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "..                             ...        ...             ...     ...     ...   \n",
       "195               Fudan University     Junior    Xiaojuan Sun  Female   153.9   \n",
       "196            Tsinghua University     Senior         Li Zhao  Female   160.9   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "199            Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "0      46.0        N            1   2019/10/5     0:04:34  \n",
       "1      70.0        N            1    2019/9/4     0:04:20  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "3      41.0        N            2    2020/1/3     0:04:08  \n",
       "4      74.0        N            2   2019/11/6     0:05:22  \n",
       "..      ...      ...          ...         ...         ...  \n",
       "195    46.0        N            2  2019/10/17     0:04:31  \n",
       "196    50.0        N            3   2019/9/22     0:04:03  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  \n",
       "199    51.0        N            1   2019/11/6     0:05:05  \n",
       "\n",
       "[200 rows x 10 columns]"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['School'].value_counts()\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a1a4acb5",
   "metadata": {},
   "source": [
    "## 实践一  \n",
    "* 请计算：所有不同学校的身高、体重的均值、最大值、最小值\n",
    "* 请计算：所有不同学校的男女比例情况\n",
    "* 统计：不同学校的 Grade 的数量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "59780627",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Shanghai Jiao Tong University', 'Peking University',\n",
       "       'Fudan University', 'Tsinghua University'], dtype=object)"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['School'].unique()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "56d80f65",
   "metadata": {},
   "source": [
    "* query()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "1eec5801",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Juan Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Changjuan You</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.4</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Changmei Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.6</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changli Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>148.7</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/13</td>\n",
       "      <td>0:04:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.9</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaoli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.4</td>\n",
       "      <td>78.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/8</td>\n",
       "      <td>0:03:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaojuan Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>79.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/10</td>\n",
       "      <td>0:04:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Qiang Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>185.3</td>\n",
       "      <td>87.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:03:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Quan Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.7</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/28</td>\n",
       "      <td>0:04:47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaojuan Chu</td>\n",
       "      <td>Male</td>\n",
       "      <td>162.4</td>\n",
       "      <td>58.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/11/29</td>\n",
       "      <td>0:03:42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changquan Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.6</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:04:18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoli Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.3</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/11</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaopeng Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>172.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/23</td>\n",
       "      <td>0:05:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoquan Zhou</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.8</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/5</td>\n",
       "      <td>0:04:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Qiang You</td>\n",
       "      <td>Female</td>\n",
       "      <td>170.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/31</td>\n",
       "      <td>0:04:27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Mei Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.2</td>\n",
       "      <td>39.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/5</td>\n",
       "      <td>0:04:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Zheng</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.6</td>\n",
       "      <td>49.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/5</td>\n",
       "      <td>0:04:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaopeng Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.1</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/18</td>\n",
       "      <td>0:05:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changmei Feng</td>\n",
       "      <td>Female</td>\n",
       "      <td>163.8</td>\n",
       "      <td>56.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/11/8</td>\n",
       "      <td>0:04:41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changpeng Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>181.3</td>\n",
       "      <td>83.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/24</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaoli Zhou</td>\n",
       "      <td>Female</td>\n",
       "      <td>166.8</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/28</td>\n",
       "      <td>0:05:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>102</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/13</td>\n",
       "      <td>0:03:55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>167.2</td>\n",
       "      <td>66.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Peng Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>147.8</td>\n",
       "      <td>34.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/19</td>\n",
       "      <td>0:03:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changquan Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>173.4</td>\n",
       "      <td>77.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/4</td>\n",
       "      <td>0:03:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Feng</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/28</td>\n",
       "      <td>0:05:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>132</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chunpeng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/10</td>\n",
       "      <td>0:04:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Qiang Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>152.7</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/30</td>\n",
       "      <td>0:05:27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>147</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Juan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>169.2</td>\n",
       "      <td>69.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/31</td>\n",
       "      <td>0:05:28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengpeng Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/2</td>\n",
       "      <td>0:03:53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>183</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaofeng Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:05:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>185</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Chunmei Wang</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.2</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/10</td>\n",
       "      <td>0:04:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>194</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Yanmei Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.3</td>\n",
       "      <td>49.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/3</td>\n",
       "      <td>0:05:08</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                School      Grade            Name  Gender  Height  Weight  \\\n",
       "1    Peking University   Freshman  Changqiang You    Male   166.5    70.0   \n",
       "9    Peking University     Junior         Juan Xu  Female   164.8     NaN   \n",
       "20   Peking University     Junior   Changjuan You  Female   161.4    47.0   \n",
       "29   Peking University  Sophomore     Changmei Xu  Female   151.6    43.0   \n",
       "30   Peking University     Senior      Changli Lv  Female   148.7    41.0   \n",
       "32   Peking University   Freshman     Gaopeng Shi  Female   162.9    48.0   \n",
       "35   Peking University   Freshman      Gaoli Zhao    Male   175.4    78.0   \n",
       "36   Peking University   Freshman    Xiaojuan Qin    Male     NaN    79.0   \n",
       "38   Peking University   Freshman       Qiang Han    Male   185.3    87.0   \n",
       "45   Peking University   Freshman        Quan Chu  Female   154.7    43.0   \n",
       "54   Peking University   Freshman    Xiaojuan Chu    Male   162.4    58.0   \n",
       "57   Peking University   Freshman   Changquan Chu  Female   159.6    45.0   \n",
       "59   Peking University     Junior        Gaoli Xu  Female   157.3    48.0   \n",
       "61   Peking University  Sophomore    Xiaopeng Qin    Male   172.8     NaN   \n",
       "72   Peking University     Junior    Gaoquan Zhou    Male   166.8    70.0   \n",
       "75   Peking University     Junior       Qiang You  Female   170.0    56.0   \n",
       "83   Peking University  Sophomore          Mei Xu  Female   154.2    39.0   \n",
       "86   Peking University     Senior      Feng Zheng  Female   162.6    49.0   \n",
       "88   Peking University   Freshman    Xiaopeng Han  Female   164.1    53.0   \n",
       "96   Peking University   Freshman   Changmei Feng  Female   163.8    56.0   \n",
       "99   Peking University   Freshman  Changpeng Zhao    Male   181.3    83.0   \n",
       "101  Peking University  Sophomore     Xiaoli Zhou  Female   166.8    55.0   \n",
       "102  Peking University     Junior    Chengli Zhao    Male     NaN     NaN   \n",
       "116  Peking University     Senior       Feng Zhao    Male   167.2    66.0   \n",
       "120  Peking University  Sophomore        Peng Han  Female   147.8    34.0   \n",
       "127  Peking University     Senior   Changquan Han    Male   173.4    77.0   \n",
       "130  Peking University     Senior        Mei Feng  Female     NaN    51.0   \n",
       "132  Peking University     Senior   Chunpeng Qian  Female   161.6     NaN   \n",
       "140  Peking University   Freshman     Qiang Zhang  Female   152.7    43.0   \n",
       "147  Peking University     Senior        Juan You    Male   169.2    69.0   \n",
       "159  Peking University     Junior  Chengpeng Zhao  Female   156.0    44.0   \n",
       "183  Peking University     Junior   Xiaofeng Zhao  Female   159.9    46.0   \n",
       "185  Peking University   Freshman    Chunmei Wang  Female   151.2    43.0   \n",
       "194  Peking University     Senior     Yanmei Qian  Female   160.3    49.0   \n",
       "\n",
       "    Transfer  Test_Number   Test_Date Time_Record  \n",
       "1          N            1    2019/9/4     0:04:20  \n",
       "9          N            3   2019/10/5     0:04:05  \n",
       "20         N            1   2019/10/5     0:04:08  \n",
       "29         N            2    2020/1/3     0:04:28  \n",
       "30         N            2  2019/11/13     0:04:54  \n",
       "32         N            1   2019/9/12     0:04:58  \n",
       "35         N            2   2019/10/8     0:03:32  \n",
       "36         Y            1  2019/12/10     0:04:10  \n",
       "38         N            3    2020/1/7     0:03:58  \n",
       "45         N            1  2019/11/28     0:04:47  \n",
       "54         Y            3  2019/11/29     0:03:42  \n",
       "57         N            2   2019/12/9     0:04:18  \n",
       "59         N            2  2019/12/11     0:05:13  \n",
       "61         N            1  2019/12/23     0:05:29  \n",
       "72         N            2    2019/9/5     0:04:24  \n",
       "75         N            3  2019/12/31     0:04:27  \n",
       "83         N            2   2019/11/5     0:04:29  \n",
       "86         N            2   2019/11/5     0:04:11  \n",
       "88         N            1  2019/12/18     0:05:20  \n",
       "96         N            3   2019/11/8     0:04:41  \n",
       "99         N            2  2019/10/24     0:04:08  \n",
       "101        N            1  2019/10/28     0:05:24  \n",
       "102      NaN            1  2019/10/13     0:03:55  \n",
       "116        N            1    2020/1/3     0:04:56  \n",
       "120      NaN            2   2019/9/19     0:03:32  \n",
       "127        N            1   2019/11/4     0:03:56  \n",
       "130        N            3   2019/9/28     0:05:29  \n",
       "132        N            1  2019/11/10     0:04:10  \n",
       "140        N            1  2019/11/30     0:05:27  \n",
       "147      NaN            1  2019/10/31     0:05:28  \n",
       "159        N            1    2019/9/2     0:03:53  \n",
       "183        N            1  2019/10/17     0:05:20  \n",
       "185        N            2  2019/12/10     0:04:24  \n",
       "194      NaN            1   2019/12/3     0:05:08  "
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.query(\" School ==  'Peking University'\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "c72a67f6",
   "metadata": {},
   "outputs": [],
   "source": [
    "u1 = df.query(\"School == 'Peking University'\")  # test1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "15beb77a",
   "metadata": {},
   "outputs": [],
   "source": [
    "u11 = u1[['Height','Weight']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "3ff789cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>31.000000</td>\n",
       "      <td>30.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>162.977419</td>\n",
       "      <td>55.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>8.969530</td>\n",
       "      <td>14.605935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>147.800000</td>\n",
       "      <td>34.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>156.650000</td>\n",
       "      <td>44.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>162.600000</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>167.000000</td>\n",
       "      <td>68.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>185.300000</td>\n",
       "      <td>87.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Height     Weight\n",
       "count   31.000000  30.000000\n",
       "mean   162.977419  55.666667\n",
       "std      8.969530  14.605935\n",
       "min    147.800000  34.000000\n",
       "25%    156.650000  44.250000\n",
       "50%    162.600000  50.000000\n",
       "75%    167.000000  68.250000\n",
       "max    185.300000  87.000000"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u11.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "f05ee967",
   "metadata": {},
   "outputs": [],
   "source": [
    "u2 = df.query(\"School == 'Shanghai Jiao Tong University'\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "edb27ae1",
   "metadata": {},
   "outputs": [],
   "source": [
    "u22 = u1[['Height','Weight']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "729e2362",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>31.000000</td>\n",
       "      <td>30.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>162.977419</td>\n",
       "      <td>55.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>8.969530</td>\n",
       "      <td>14.605935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>147.800000</td>\n",
       "      <td>34.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>156.650000</td>\n",
       "      <td>44.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>162.600000</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>167.000000</td>\n",
       "      <td>68.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>185.300000</td>\n",
       "      <td>87.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Height     Weight\n",
       "count   31.000000  30.000000\n",
       "mean   162.977419  55.666667\n",
       "std      8.969530  14.605935\n",
       "min    147.800000  34.000000\n",
       "25%    156.650000  44.250000\n",
       "50%    162.600000  50.000000\n",
       "75%    167.000000  68.250000\n",
       "max    185.300000  87.000000"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u22.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "dbe4a541",
   "metadata": {},
   "outputs": [],
   "source": [
    "u3 = df.query(\"School == 'Fudan University'\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "25d42956",
   "metadata": {},
   "outputs": [],
   "source": [
    "u33 = u1[['Height','Weight']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "f1de7f67",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>31.000000</td>\n",
       "      <td>30.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>162.977419</td>\n",
       "      <td>55.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>8.969530</td>\n",
       "      <td>14.605935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>147.800000</td>\n",
       "      <td>34.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>156.650000</td>\n",
       "      <td>44.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>162.600000</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>167.000000</td>\n",
       "      <td>68.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>185.300000</td>\n",
       "      <td>87.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Height     Weight\n",
       "count   31.000000  30.000000\n",
       "mean   162.977419  55.666667\n",
       "std      8.969530  14.605935\n",
       "min    147.800000  34.000000\n",
       "25%    156.650000  44.250000\n",
       "50%    162.600000  50.000000\n",
       "75%    167.000000  68.250000\n",
       "max    185.300000  87.000000"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u22.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "eadf16e9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>31.000000</td>\n",
       "      <td>30.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>162.977419</td>\n",
       "      <td>55.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>8.969530</td>\n",
       "      <td>14.605935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>147.800000</td>\n",
       "      <td>34.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>156.650000</td>\n",
       "      <td>44.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>162.600000</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>167.000000</td>\n",
       "      <td>68.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>185.300000</td>\n",
       "      <td>87.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Height     Weight\n",
       "count   31.000000  30.000000\n",
       "mean   162.977419  55.666667\n",
       "std      8.969530  14.605935\n",
       "min    147.800000  34.000000\n",
       "25%    156.650000  44.250000\n",
       "50%    162.600000  50.000000\n",
       "75%    167.000000  68.250000\n",
       "max    185.300000  87.000000"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u4 = df.query(\"School == 'Peking University'\")\n",
    "u44 = u1[['Height','Weight']]\n",
    "u44.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "0fbc19d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Freshman     13\n",
       "Junior        8\n",
       "Senior        8\n",
       "Sophomore     5\n",
       "Name: Grade, dtype: int64"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u1['Grade'].value_counts()   #test3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "bbe20c70",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Senior       22\n",
       "Junior       17\n",
       "Freshman     13\n",
       "Sophomore     5\n",
       "Name: Grade, dtype: int64"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u2['Grade'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "35e2e3ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Junior       12\n",
       "Senior       11\n",
       "Freshman      9\n",
       "Sophomore     8\n",
       "Name: Grade, dtype: int64"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u3['Grade'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "1277dd32",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Freshman     13\n",
       "Junior        8\n",
       "Senior        8\n",
       "Sophomore     5\n",
       "Name: Grade, dtype: int64"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u4['Grade'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "84a1c230",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Female    22\n",
       "Male      12\n",
       "Name: Gender, dtype: int64"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u1['Gender'].value_counts()   #test2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "1a360cf3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.2807017543859649"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pu1 = 16/(41+16)\n",
    "pu1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "7935b0a0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Female    41\n",
       "Male      16\n",
       "Name: Gender, dtype: int64"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u2['Gender'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "fe3e2172",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.2807017543859649"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pu1 = 16/(41+16)\n",
    "pu1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "73adb215",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Female    30\n",
       "Male      10\n",
       "Name: Gender, dtype: int64"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u3['Gender'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "29670bc6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.25"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pu1 = 10/(10+30)\n",
    "pu1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "cf09f05c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Female    22\n",
       "Male      12\n",
       "Name: Gender, dtype: int64"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u4['Gender'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "ba8e2a7d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.35294117647058826"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pu1 = 12/(22+12)\n",
    "pu1"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5f663aab",
   "metadata": {},
   "source": [
    "# 实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "03db88b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>排名</td>\n",
       "      <td>排名变化</td>\n",
       "      <td>企业名称</td>\n",
       "      <td>价值（亿元人民币）</td>\n",
       "      <td>价值变化（亿元人民币）</td>\n",
       "      <td>国家</td>\n",
       "      <td>城市</td>\n",
       "      <td>行业</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>102 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      0     1                    2          3            4   5      6     7\n",
       "0    排名  排名变化                 企业名称  价值（亿元人民币）  价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1     0                   抖音      13400       -10050  中国     北京  社交媒体\n",
       "2     2     1               SpaceX       8400         1680  美国    洛杉矶    航天\n",
       "3     3    -1                 蚂蚁集团       8000        -2010  中国     杭州  金融科技\n",
       "4     4     0               Stripe       4100        -2210  美国    旧金山  金融科技\n",
       "..   ..   ...                  ...        ...          ...  ..    ...   ...\n",
       "97   95   -16        Impossible 食品        470            0  美国  雷德伍德城  食品饮料\n",
       "98   95   -16                   微医        470            0  中国     杭州  健康科技\n",
       "99   99    58                 蜂巢能源        460          190  中国     常州   新能源\n",
       "100  99    -6           Better.com        460           60  美国     纽约  金融科技\n",
       "101  99   -20  Automation Anywhere        460          -10  美国    圣何塞  人工智能\n",
       "\n",
       "[102 rows x 8 columns]"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "hurun_独角兽 = pd.read_html('https://www.hurun.net/zh-CN/Info/Detail?num=L9SQPH9FKJB1')[-3]\n",
    "hurun_独角兽"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4630f9e1",
   "metadata": {},
   "source": [
    "# week4 \n",
    "* 日期：2023-03-15\\\\ week04（周三）  \n",
    "* 课程：Python-data-analysis-couse  \n",
    "* 记录人：黄斐珍"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c85d6159",
   "metadata": {},
   "source": [
    "## 数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "b32d3753",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "ef1333ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "0    Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1                Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2    Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3                 Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4                 Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "..                             ...        ...             ...     ...     ...   \n",
       "195               Fudan University     Junior    Xiaojuan Sun  Female   153.9   \n",
       "196            Tsinghua University     Senior         Li Zhao  Female   160.9   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "199            Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "0      46.0        N            1   2019/10/5     0:04:34  \n",
       "1      70.0        N            1    2019/9/4     0:04:20  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "3      41.0        N            2    2020/1/3     0:04:08  \n",
       "4      74.0        N            2   2019/11/6     0:05:22  \n",
       "..      ...      ...          ...         ...         ...  \n",
       "195    46.0        N            2  2019/10/17     0:04:31  \n",
       "196    50.0        N            3   2019/9/22     0:04:03  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  \n",
       "199    51.0        N            1   2019/11/6     0:05:05  \n",
       "\n",
       "[200 rows x 10 columns]"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('E:\\Python Data Analysis Couse\\python-data-analysis-couse\\课堂笔记\\data\\learn_pandas.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "id": "ed63d4a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          School      Grade            Name  Gender  Height  \\\n",
       "0  Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1              Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2  Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3               Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4               Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "\n",
       "   Weight Transfer  Test_Number  Test_Date Time_Record  \n",
       "0    46.0        N            1  2019/10/5     0:04:34  \n",
       "1    70.0        N            1   2019/9/4     0:04:20  \n",
       "2    89.0        N            2  2019/9/12     0:05:22  \n",
       "3    41.0        N            2   2020/1/3     0:04:08  \n",
       "4    74.0        N            2  2019/11/6     0:05:22  "
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "id": "33b43251",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "195               Fudan University     Junior    Xiaojuan Sun  Female   153.9   \n",
       "196            Tsinghua University     Senior         Li Zhao  Female   160.9   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "199            Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "195    46.0        N            2  2019/10/17     0:04:31  \n",
       "196    50.0        N            3   2019/9/22     0:04:03  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  \n",
       "199    51.0        N            1   2019/11/6     0:05:05  "
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "77f40ab3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 200 entries, 0 to 199\n",
      "Data columns (total 10 columns):\n",
      " #   Column       Non-Null Count  Dtype  \n",
      "---  ------       --------------  -----  \n",
      " 0   School       200 non-null    object \n",
      " 1   Grade        200 non-null    object \n",
      " 2   Name         200 non-null    object \n",
      " 3   Gender       200 non-null    object \n",
      " 4   Height       183 non-null    float64\n",
      " 5   Weight       189 non-null    float64\n",
      " 6   Transfer     188 non-null    object \n",
      " 7   Test_Number  200 non-null    int64  \n",
      " 8   Test_Date    200 non-null    object \n",
      " 9   Time_Record  200 non-null    object \n",
      "dtypes: float64(2), int64(1), object(7)\n",
      "memory usage: 15.8+ KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d2e0df75",
   "metadata": {},
   "source": [
    "## 实践一  \n",
    "* 计算有多少所学校？  \n",
    "> 方法：先找到这一列，然后用unique  \n",
    "* 计算所有身高的平均值、最大值、最小值  \n",
    "* 测试数量分别有多少个？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "a4acb6e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Shanghai Jiao Tong University', 'Peking University',\n",
       "       'Fudan University', 'Tsinghua University'], dtype=object)"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['School'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "8c269151",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Gaopeng Yang', 'Changqiang You', 'Mei Sun', 'Xiaojuan Sun',\n",
       "       'Gaojuan You', 'Xiaoli Qian', 'Qiang Chu', 'Gaoqiang Qian',\n",
       "       'Changli Zhang', 'Juan Xu', 'Xiaopeng Zhou', 'Xiaoquan Lv',\n",
       "       'Peng You', 'Yanfeng Qian', 'Xiaomei Zhou', 'Changqiang Yang',\n",
       "       'Xiaoqiang Qin', 'Peng Wang', 'Xiaofeng Sun', 'Changjuan You',\n",
       "       'Xiaopeng Shen', 'Changqiang Sun', 'Qiang Zheng', 'Chunmei You',\n",
       "       'Xiaopeng Chu', 'Yanli You', 'Qiang Sun', 'Gaoqiang Qin',\n",
       "       'Changmei Xu', 'Changli Lv', 'Feng Zheng', 'Gaopeng Shi',\n",
       "       'Yanjuan Han', 'Li Wu', 'Gaoli Zhao', 'Xiaojuan Qin',\n",
       "       'Xiaoquan Zhang', 'Qiang Han', 'Chengpeng Zheng', 'Li Wang',\n",
       "       'Chunqiang Chu', 'Mei Zhang', 'Gaoli Feng', 'Yanqiang Feng',\n",
       "       'Quan Chu', 'Feng Zhou', 'Peng Wu', 'Mei Xu', 'Gaomei Lv',\n",
       "       'Xiaoli Wang', 'Chengquan Chu', 'Chunli Lv', 'Chengli You',\n",
       "       'Xiaojuan Chu', 'Chengquan Zhang', 'Qiang Lv', 'Changquan Chu',\n",
       "       'Gaoli Xu', 'Yanpeng Lv', 'Xiaopeng Qin', 'Xiaoli Xu',\n",
       "       'Gaofeng Zhao', 'Yanmei Yang', 'Chengpeng Zhou', 'Gaoquan Sun',\n",
       "       'Chengqiang Lv', 'Chunquan Xu', 'Yanquan Wang', 'Feng Han',\n",
       "       'Gaoquan Zhou', 'Feng Wang', 'Yanli Qin', 'Qiang You',\n",
       "       'Yanquan Lv', 'Gaopeng Qin', 'Li Xu', 'Changmei Sun',\n",
       "       'Yanli Zhang', 'Changfeng Lv', 'Yanjuan Lv', 'Li Chu', 'Feng Yang',\n",
       "       'Xiaopeng Han', 'Gaojuan Zhao', 'Gaoqiang Zhou', 'Yanfeng Han',\n",
       "       'Juan Zhao', 'Feng Zhao', 'Yanli Wang', 'Changmei Feng',\n",
       "       'Changpeng Zhao', 'Xiaofeng Shi', 'Xiaoli Zhou', 'Chengli Zhao',\n",
       "       'Mei Chen', 'Xiaopeng Lv', 'Qiang Shi', 'Xiaojuan Zhao',\n",
       "       'Yanqiang Xu', 'Chunpeng Lv', 'Xiaomei Shi', 'Gaoquan Xu',\n",
       "       'Chunjuan Xu', 'Changjuan Xu', 'Xiaopeng Zhao', 'Gaofeng Sun',\n",
       "       'Chunli Zhao', 'Peng Zhang', 'Peng Han', 'Xiaoquan Sun',\n",
       "       'Chunpeng Shi', 'Juan You', 'Changquan Han', 'Xiaofeng You',\n",
       "       'Juan Zhang', 'Mei Feng', 'Chengpeng Qian', 'Chunpeng Qian',\n",
       "       'Gaojuan Qin', 'Changqiang Qian', 'Li Lv', 'Chengquan Shi',\n",
       "       'Xiaojuan Qian', 'Qiang Zhou', 'Qiang Zhang', 'Chunmei Shi',\n",
       "       'Xiaoli Chu', 'Quan Xu', 'Gaoquan Chu', 'Xiaomei Yang',\n",
       "       'Xiaofeng Qian', 'Chengpeng You', 'Feng Qian', 'Chengli Sun',\n",
       "       'Changmei Lv', 'Yanpeng Han', 'Chunmei Han', 'Juan Qin',\n",
       "       'Xiaoli Lv', 'Chengqiang Zhang', 'Chengpeng Zhao', 'Chunfeng Zhao',\n",
       "       'Quan Qian', 'Chengjuan Zhang', 'Gaoquan Shen', 'Qiang Wang',\n",
       "       'Xiaopeng Qian', 'Xiaoqiang Feng', 'Gaoli Wu', 'Chengquan Qin',\n",
       "       'Li Sun', 'Xiaofeng Zhang', 'Quan Zhao', 'Gaojuan Qian',\n",
       "       'Xiaopeng Sun', 'Li Qin', 'Mei Zheng', 'Yanjuan You',\n",
       "       'Xiaoqiang Qian', 'Xiaofeng Zhao', 'Qiang Feng', 'Chunmei Wang',\n",
       "       'Yanjuan Zhao', 'Chunjuan Zhang', 'Changli Qin', 'Gaojuan Wang',\n",
       "       'Yanmei Qian', 'Li Zhao', 'Chengqiang Chu', 'Chengmei Shen'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Name'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "00c2b9a8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Freshman', 'Senior', 'Sophomore', 'Junior'], dtype=object)"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Grade'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "26455d35",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2, 3], dtype=int64)"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Test_Number'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "8078a684",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "163.21803278688526"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Height'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "ae161be5",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_demo = df[['Height','Weight']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "f9470681",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Height    163.218033\n",
       "Weight     55.015873\n",
       "dtype: float64"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo.mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "e3f60444",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Height    193.9\n",
       "Weight     89.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo.max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "ce707145",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Height    145.4\n",
       "Weight     34.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo.min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "01a926b2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Tsinghua University              69\n",
       "Shanghai Jiao Tong University    57\n",
       "Fudan University                 40\n",
       "Peking University                34\n",
       "Name: School, dtype: int64"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['School'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "a197039b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_quantity = df[['Test_Number']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "bbbcf06b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Test_Number\n",
       "1              100\n",
       "2               71\n",
       "3               29\n",
       "dtype: int64"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_quantity.value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "933b7e95",
   "metadata": {},
   "source": [
    "## 进阶版实践一  \n",
    "* 请计算：所有不同学校的身高、体重的均值、最大值、最小值\n",
    "* 请计算：所有不同学校的男女比例情况  \n",
    "* 统计：不同学校的 Grade 的数量\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "0d8fe9fa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "163.21803278688526"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Height'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "339261a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaoli Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.0</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/31</td>\n",
       "      <td>0:03:47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoqiang Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/3</td>\n",
       "      <td>0:03:45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changli Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>163.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaoquan Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.2</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/16</td>\n",
       "      <td>0:04:49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaomei Zhou</td>\n",
       "      <td>Female</td>\n",
       "      <td>165.3</td>\n",
       "      <td>57.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/29</td>\n",
       "      <td>0:05:25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>182</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaoqiang Qian</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.5</td>\n",
       "      <td>73.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/10/3</td>\n",
       "      <td>0:04:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>191</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Li Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>166.6</td>\n",
       "      <td>54.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/3</td>\n",
       "      <td>0:04:45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>193</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaoqiang Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>193.9</td>\n",
       "      <td>79.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>69 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                  School      Grade            Name  Gender  Height  Weight  \\\n",
       "5    Tsinghua University   Freshman     Xiaoli Qian  Female   158.0    51.0   \n",
       "7    Tsinghua University     Junior   Gaoqiang Qian  Female   161.9    50.0   \n",
       "8    Tsinghua University   Freshman   Changli Zhang  Female   163.0    48.0   \n",
       "11   Tsinghua University     Junior     Xiaoquan Lv  Female   153.2    43.0   \n",
       "14   Tsinghua University     Senior    Xiaomei Zhou  Female   165.3    57.0   \n",
       "..                   ...        ...             ...     ...     ...     ...   \n",
       "182  Tsinghua University  Sophomore  Xiaoqiang Qian    Male   170.5    73.0   \n",
       "191  Tsinghua University     Junior          Li Sun  Female   166.6    54.0   \n",
       "193  Tsinghua University     Senior   Xiaoqiang Qin    Male   193.9    79.0   \n",
       "196  Tsinghua University     Senior         Li Zhao  Female   160.9    50.0   \n",
       "199  Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7    51.0   \n",
       "\n",
       "    Transfer  Test_Number   Test_Date Time_Record  \n",
       "5          N            1  2019/10/31     0:03:47  \n",
       "7          N            1    2019/9/3     0:03:45  \n",
       "8          N            1    2020/1/5     0:05:13  \n",
       "11         N            2   2019/9/16     0:04:49  \n",
       "14         N            1  2019/12/29     0:05:25  \n",
       "..       ...          ...         ...         ...  \n",
       "182        N            3   2019/10/3     0:04:11  \n",
       "191        N            2    2019/9/3     0:04:45  \n",
       "193        N            2   2019/11/6     0:05:09  \n",
       "196        N            3   2019/9/22     0:04:03  \n",
       "199        N            1   2019/11/6     0:05:05  \n",
       "\n",
       "[69 rows x 10 columns]"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_Tsinghua = df.query('School == \"Tsinghua University\" ')\n",
    "df_Tsinghua"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "1a552bba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "163.14920634920634"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_Tsinghua['Height'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "25a27403",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaoqiang Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.1</td>\n",
       "      <td>68.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/11</td>\n",
       "      <td>0:04:51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Peng Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>162.8</td>\n",
       "      <td>65.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/2</td>\n",
       "      <td>0:04:53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaofeng Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/4</td>\n",
       "      <td>0:03:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chunmei You</td>\n",
       "      <td>Male</td>\n",
       "      <td>167.4</td>\n",
       "      <td>69.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/17</td>\n",
       "      <td>0:04:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Li Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/7</td>\n",
       "      <td>0:04:12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Yanli Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>169.4</td>\n",
       "      <td>74.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/3</td>\n",
       "      <td>0:03:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Yanquan Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/26</td>\n",
       "      <td>0:03:59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Yanfeng Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/7</td>\n",
       "      <td>0:04:45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Yanli Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>169.9</td>\n",
       "      <td>67.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/29</td>\n",
       "      <td>0:05:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Yanfeng Qian</td>\n",
       "      <td>Male</td>\n",
       "      <td>178.7</td>\n",
       "      <td>75.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/23</td>\n",
       "      <td>0:05:19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>150</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengpeng You</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.7</td>\n",
       "      <td>70.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/5</td>\n",
       "      <td>0:05:16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>158</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengqiang Zhang</td>\n",
       "      <td>Male</td>\n",
       "      <td>176.1</td>\n",
       "      <td>76.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/16</td>\n",
       "      <td>0:04:25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>160</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chunfeng Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>173.4</td>\n",
       "      <td>72.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/25</td>\n",
       "      <td>0:04:02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>162</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengjuan Zhang</td>\n",
       "      <td>Male</td>\n",
       "      <td>168.4</td>\n",
       "      <td>65.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/30</td>\n",
       "      <td>0:05:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoqiang Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>167.1</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/11</td>\n",
       "      <td>0:04:14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Li Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>76.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:05:19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>179</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Peng Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.5</td>\n",
       "      <td>73.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/10/3</td>\n",
       "      <td>0:05:14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>181</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Yanjuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/23</td>\n",
       "      <td>0:03:50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>182</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaoqiang Qian</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.5</td>\n",
       "      <td>73.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/10/3</td>\n",
       "      <td>0:04:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>193</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaoqiang Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>193.9</td>\n",
       "      <td>79.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  School      Grade              Name Gender  Height  Weight  \\\n",
       "16   Tsinghua University     Junior     Xiaoqiang Qin   Male   170.1    68.0   \n",
       "17   Tsinghua University     Junior         Peng Wang   Male   162.8    65.0   \n",
       "18   Tsinghua University     Senior      Xiaofeng Sun   Male   170.3    71.0   \n",
       "24   Tsinghua University     Senior       Chunmei You   Male   167.4    69.0   \n",
       "40   Tsinghua University  Sophomore           Li Wang   Male   175.0    79.0   \n",
       "74   Tsinghua University  Sophomore         Yanli Qin   Male   169.4    74.0   \n",
       "76   Tsinghua University  Sophomore        Yanquan Lv   Male   174.6     NaN   \n",
       "91   Tsinghua University  Sophomore       Yanfeng Han   Male     NaN     NaN   \n",
       "94   Tsinghua University     Junior        Yanli Wang   Male   169.9    67.0   \n",
       "95   Tsinghua University     Junior      Yanfeng Qian   Male   178.7    75.0   \n",
       "150  Tsinghua University     Junior     Chengpeng You   Male   170.7    70.0   \n",
       "158  Tsinghua University     Junior  Chengqiang Zhang   Male   176.1    76.0   \n",
       "160  Tsinghua University     Junior     Chunfeng Zhao   Male   173.4    72.0   \n",
       "162  Tsinghua University     Junior   Chengjuan Zhang   Male   168.4    65.0   \n",
       "177  Tsinghua University     Junior      Gaoqiang Qin   Male   167.1    71.0   \n",
       "178  Tsinghua University  Sophomore            Li Qin   Male     NaN    76.0   \n",
       "179  Tsinghua University     Senior         Peng Wang   Male   175.5    73.0   \n",
       "181  Tsinghua University  Sophomore       Yanjuan You   Male     NaN    55.0   \n",
       "182  Tsinghua University  Sophomore    Xiaoqiang Qian   Male   170.5    73.0   \n",
       "193  Tsinghua University     Senior     Xiaoqiang Qin   Male   193.9    79.0   \n",
       "199  Tsinghua University  Sophomore       Chunpeng Lv   Male   155.7    51.0   \n",
       "\n",
       "    Transfer  Test_Number   Test_Date Time_Record  \n",
       "16         N            1   2019/9/11     0:04:51  \n",
       "17         N            1   2019/11/2     0:04:53  \n",
       "18         N            2   2019/11/4     0:03:32  \n",
       "24         N            1  2019/11/17     0:04:32  \n",
       "40         N            1   2019/10/7     0:04:12  \n",
       "74         Y            1    2019/9/3     0:03:32  \n",
       "76         N            3   2019/9/26     0:03:59  \n",
       "91         N            1    2019/9/7     0:04:45  \n",
       "94         N            2  2019/12/29     0:05:24  \n",
       "95         N            2  2019/11/23     0:05:19  \n",
       "150        Y            1   2019/12/5     0:05:16  \n",
       "158        N            2  2019/11/16     0:04:25  \n",
       "160        N            1   2019/9/25     0:04:02  \n",
       "162        N            2  2019/11/30     0:05:00  \n",
       "177        N            2  2019/10/11     0:04:14  \n",
       "178        N            3    2020/1/7     0:05:19  \n",
       "179        N            3   2019/10/3     0:05:14  \n",
       "181        N            1  2019/11/23     0:03:50  \n",
       "182        N            3   2019/10/3     0:04:11  \n",
       "193        N            2   2019/11/6     0:05:09  \n",
       "199        N            1   2019/11/6     0:05:05  "
      ]
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_Tsinghua_Male = df.query('School == \"Tsinghua University\" and Gender == \"Male\" ')\n",
    "df_Tsinghua_Male"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "id": "06831066",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "171.63888888888889"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_Tsinghua_Male['Height'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "id": "4fd22459",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "School               Grade      Name              Gender  Height  Weight  Transfer  Test_Number  Test_Date   Time_Record\n",
       "Tsinghua University  Junior     Chengjuan Zhang   Male    168.4   65.0    N         2            2019/11/30  0:05:00        1\n",
       "                     Senior     Chunmei You       Male    167.4   69.0    N         1            2019/11/17  0:04:32        1\n",
       "                     Sophomore  Xiaoqiang Qian    Male    170.5   73.0    N         3            2019/10/3   0:04:11        1\n",
       "                                Li Wang           Male    175.0   79.0    N         1            2019/10/7   0:04:12        1\n",
       "                                Chunpeng Lv       Male    155.7   51.0    N         1            2019/11/6   0:05:05        1\n",
       "                     Senior     Xiaoqiang Qin     Male    193.9   79.0    N         2            2019/11/6   0:05:09        1\n",
       "                                Xiaofeng Sun      Male    170.3   71.0    N         2            2019/11/4   0:03:32        1\n",
       "                                Peng Wang         Male    175.5   73.0    N         3            2019/10/3   0:05:14        1\n",
       "                     Junior     Yanli Wang        Male    169.9   67.0    N         2            2019/12/29  0:05:24        1\n",
       "                                Chengpeng You     Male    170.7   70.0    Y         1            2019/12/5   0:05:16        1\n",
       "                                Yanfeng Qian      Male    178.7   75.0    N         2            2019/11/23  0:05:19        1\n",
       "                                Xiaoqiang Qin     Male    170.1   68.0    N         1            2019/9/11   0:04:51        1\n",
       "                                Peng Wang         Male    162.8   65.0    N         1            2019/11/2   0:04:53        1\n",
       "                                Gaoqiang Qin      Male    167.1   71.0    N         2            2019/10/11  0:04:14        1\n",
       "                                Chunfeng Zhao     Male    173.4   72.0    N         1            2019/9/25   0:04:02        1\n",
       "                                Chengqiang Zhang  Male    176.1   76.0    N         2            2019/11/16  0:04:25        1\n",
       "                     Sophomore  Yanli Qin         Male    169.4   74.0    Y         1            2019/9/3    0:03:32        1\n",
       "dtype: int64"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_Tsinghua_Male.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "id": "b2d9ee77",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaoli Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.0</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/31</td>\n",
       "      <td>0:03:47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoqiang Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/3</td>\n",
       "      <td>0:03:45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changli Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>163.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaoquan Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.2</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/16</td>\n",
       "      <td>0:04:49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaomei Zhou</td>\n",
       "      <td>Female</td>\n",
       "      <td>165.3</td>\n",
       "      <td>57.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/29</td>\n",
       "      <td>0:05:25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.5</td>\n",
       "      <td>42.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/19</td>\n",
       "      <td>0:04:59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Qiang Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>163.1</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/11</td>\n",
       "      <td>0:05:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Yanjuan Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>163.7</td>\n",
       "      <td>49.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/11/5</td>\n",
       "      <td>0:04:39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Li Wu</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.3</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/21</td>\n",
       "      <td>0:04:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaoli Feng</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.4</td>\n",
       "      <td>46.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/30</td>\n",
       "      <td>0:04:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Yanqiang Feng</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.3</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/10</td>\n",
       "      <td>0:04:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Peng Wu</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.5</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/14</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Chengquan Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.3</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/10</td>\n",
       "      <td>0:05:02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chengli You</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.1</td>\n",
       "      <td>57.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/8</td>\n",
       "      <td>0:04:39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chengquan Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>168.9</td>\n",
       "      <td>54.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/7</td>\n",
       "      <td>0:04:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaoli Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.5</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/7</td>\n",
       "      <td>0:04:41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaoquan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.8</td>\n",
       "      <td>42.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/9</td>\n",
       "      <td>0:05:18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>69</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chunquan Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.1</td>\n",
       "      <td>54.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/27</td>\n",
       "      <td>0:04:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.5</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/29</td>\n",
       "      <td>0:03:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Changjuan You</td>\n",
       "      <td>Female</td>\n",
       "      <td>150.5</td>\n",
       "      <td>40.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Yanli Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>165.1</td>\n",
       "      <td>52.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/13</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Juan Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.2</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/28</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaoqiang Qin</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.8</td>\n",
       "      <td>54.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/6</td>\n",
       "      <td>0:05:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaofeng Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.4</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/19</td>\n",
       "      <td>0:03:33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>106</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Qiang Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.3</td>\n",
       "      <td>40.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/30</td>\n",
       "      <td>0:04:37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaomei Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.9</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/30</td>\n",
       "      <td>0:04:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>111</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaoquan Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>52.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/30</td>\n",
       "      <td>0:05:21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>113</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Changjuan Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.6</td>\n",
       "      <td>49.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/2</td>\n",
       "      <td>0:03:55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>118</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Yanli Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.6</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/24</td>\n",
       "      <td>0:03:49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Qiang Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.8</td>\n",
       "      <td>38.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/24</td>\n",
       "      <td>0:03:37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Juan You</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/12</td>\n",
       "      <td>0:03:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaofeng You</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.5</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/30</td>\n",
       "      <td>0:05:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>133</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaojuan Qin</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/7</td>\n",
       "      <td>0:05:04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>136</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Li Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>155.2</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/28</td>\n",
       "      <td>0:05:27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengquan Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.8</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>139</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Qiang Zhou</td>\n",
       "      <td>Female</td>\n",
       "      <td>150.5</td>\n",
       "      <td>36.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/4</td>\n",
       "      <td>0:04:27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Feng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/17</td>\n",
       "      <td>0:05:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>146</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Juan Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>168.6</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/30</td>\n",
       "      <td>0:05:06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>151</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Feng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.4</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/5</td>\n",
       "      <td>0:05:07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>154</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Yanpeng Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/15</td>\n",
       "      <td>0:03:47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>163</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoquan Shen</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.0</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/20</td>\n",
       "      <td>0:03:50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>168</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaoli Wu</td>\n",
       "      <td>Female</td>\n",
       "      <td>155.7</td>\n",
       "      <td>47.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/14</td>\n",
       "      <td>0:04:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>169</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengquan Qin</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.7</td>\n",
       "      <td>52.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/12</td>\n",
       "      <td>0:03:39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>175</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Yanli Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.2</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2020/1/8</td>\n",
       "      <td>0:03:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaopeng Zhou</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.2</td>\n",
       "      <td>51.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/15</td>\n",
       "      <td>0:04:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>180</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Zheng</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.1</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/10/28</td>\n",
       "      <td>0:03:42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>191</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Li Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>166.6</td>\n",
       "      <td>54.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/3</td>\n",
       "      <td>0:04:45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  School      Grade             Name  Gender  Height  Weight  \\\n",
       "5    Tsinghua University   Freshman      Xiaoli Qian  Female   158.0    51.0   \n",
       "7    Tsinghua University     Junior    Gaoqiang Qian  Female   161.9    50.0   \n",
       "8    Tsinghua University   Freshman    Changli Zhang  Female   163.0    48.0   \n",
       "11   Tsinghua University     Junior      Xiaoquan Lv  Female   153.2    43.0   \n",
       "14   Tsinghua University     Senior     Xiaomei Zhou  Female   165.3    57.0   \n",
       "25   Tsinghua University     Senior     Xiaopeng Chu  Female   156.5    42.0   \n",
       "27   Tsinghua University     Junior        Qiang Sun  Female   163.1    53.0   \n",
       "33   Tsinghua University   Freshman      Yanjuan Han  Female   163.7    49.0   \n",
       "34   Tsinghua University   Freshman            Li Wu  Female   164.3    51.0   \n",
       "43   Tsinghua University   Freshman       Gaoli Feng  Female   157.4    46.0   \n",
       "44   Tsinghua University   Freshman    Yanqiang Feng  Female   162.3    51.0   \n",
       "47   Tsinghua University   Freshman          Peng Wu  Female   162.5    53.0   \n",
       "51   Tsinghua University   Freshman    Chengquan Chu  Female   161.3    47.0   \n",
       "53   Tsinghua University  Sophomore      Chengli You  Female   164.1    57.0   \n",
       "55   Tsinghua University  Sophomore  Chengquan Zhang  Female   168.9    54.0   \n",
       "62   Tsinghua University   Freshman        Xiaoli Xu  Female   156.5    43.0   \n",
       "67   Tsinghua University   Freshman      Gaoquan Sun  Female   156.8    42.0   \n",
       "69   Tsinghua University     Junior      Chunquan Xu  Female   162.1    54.0   \n",
       "78   Tsinghua University     Senior            Li Xu  Female   161.5    53.0   \n",
       "80   Tsinghua University  Sophomore    Changjuan You  Female   150.5    40.0   \n",
       "81   Tsinghua University   Freshman      Yanli Zhang  Female   165.1    52.0   \n",
       "92   Tsinghua University     Senior        Juan Zhao  Female   161.2    47.0   \n",
       "97   Tsinghua University  Sophomore    Xiaoqiang Qin  Female   160.8    54.0   \n",
       "100  Tsinghua University     Senior     Xiaofeng Shi  Female   164.4    55.0   \n",
       "106  Tsinghua University  Sophomore        Qiang Sun  Female   154.3    40.0   \n",
       "110  Tsinghua University  Sophomore      Xiaomei Shi  Female   157.9    47.0   \n",
       "111  Tsinghua University   Freshman       Gaoquan Xu  Female     NaN    52.0   \n",
       "113  Tsinghua University     Junior     Changjuan Xu  Female   159.6    49.0   \n",
       "118  Tsinghua University     Junior      Yanli Zhang  Female   160.6    47.0   \n",
       "125  Tsinghua University   Freshman        Qiang Han  Female   151.8    38.0   \n",
       "126  Tsinghua University     Senior         Juan You  Female   154.0    40.0   \n",
       "128  Tsinghua University     Junior     Xiaofeng You  Female   158.5    45.0   \n",
       "133  Tsinghua University   Freshman      Gaojuan Qin  Female     NaN    41.0   \n",
       "136  Tsinghua University   Freshman            Li Lv  Female   155.2    44.0   \n",
       "137  Tsinghua University     Junior    Chengquan Shi  Female   160.8    51.0   \n",
       "139  Tsinghua University  Sophomore       Qiang Zhou  Female   150.5    36.0   \n",
       "142  Tsinghua University   Freshman        Feng Yang  Female   158.9    44.0   \n",
       "146  Tsinghua University   Freshman       Juan Zhang  Female   168.6    55.0   \n",
       "151  Tsinghua University  Sophomore        Feng Qian  Female   156.4    43.0   \n",
       "154  Tsinghua University     Junior      Yanpeng Han  Female     NaN    44.0   \n",
       "163  Tsinghua University     Junior     Gaoquan Shen  Female   158.0    51.0   \n",
       "168  Tsinghua University     Senior         Gaoli Wu  Female   155.7    47.0   \n",
       "169  Tsinghua University     Junior    Chengquan Qin  Female   160.7    52.0   \n",
       "175  Tsinghua University     Senior      Yanli Zhang  Female   154.2    41.0   \n",
       "176  Tsinghua University     Junior    Xiaopeng Zhou  Female   160.2    51.0   \n",
       "180  Tsinghua University     Senior        Mei Zheng  Female   161.1    50.0   \n",
       "191  Tsinghua University     Junior           Li Sun  Female   166.6    54.0   \n",
       "196  Tsinghua University     Senior          Li Zhao  Female   160.9    50.0   \n",
       "\n",
       "    Transfer  Test_Number   Test_Date Time_Record  \n",
       "5          N            1  2019/10/31     0:03:47  \n",
       "7          N            1    2019/9/3     0:03:45  \n",
       "8          N            1    2020/1/5     0:05:13  \n",
       "11         N            2   2019/9/16     0:04:49  \n",
       "14         N            1  2019/12/29     0:05:25  \n",
       "25         N            1  2019/11/19     0:04:59  \n",
       "27         N            1  2019/12/11     0:05:08  \n",
       "33         N            3   2019/11/5     0:04:39  \n",
       "34         N            1  2019/10/21     0:04:32  \n",
       "43         Y            1  2019/12/30     0:04:00  \n",
       "44         N            1  2019/12/10     0:04:13  \n",
       "47         N            2   2019/9/14     0:04:48  \n",
       "51         N            1  2019/12/10     0:05:02  \n",
       "53         N            1    2020/1/8     0:04:39  \n",
       "55         N            1   2019/12/7     0:04:29  \n",
       "62         N            1    2019/9/7     0:04:41  \n",
       "67         N            2   2019/11/9     0:05:18  \n",
       "69       NaN            1  2019/10/27     0:04:40  \n",
       "78         N            2  2019/10/29     0:03:40  \n",
       "80         N            3    2020/1/5     0:04:52  \n",
       "81         N            1   2019/9/13     0:05:05  \n",
       "92         N            1   2019/9/28     0:04:34  \n",
       "97         N            1   2019/12/6     0:05:26  \n",
       "100        N            1  2019/11/19     0:03:33  \n",
       "106        N            1  2019/12/30     0:04:37  \n",
       "110        N            1  2019/11/30     0:04:09  \n",
       "111        N            1  2019/11/30     0:05:21  \n",
       "113        N            1   2019/11/2     0:03:55  \n",
       "118        N            2  2019/10/24     0:03:49  \n",
       "125        N            2  2019/11/24     0:03:37  \n",
       "126        N            1  2019/11/12     0:03:40  \n",
       "128        N            2  2019/12/30     0:05:09  \n",
       "133        N            1   2019/10/7     0:05:04  \n",
       "136        N            2   2019/9/28     0:05:27  \n",
       "137        N            2   2019/9/22     0:04:14  \n",
       "139        N            1   2019/11/4     0:04:27  \n",
       "142        N            1   2019/9/17     0:05:11  \n",
       "146        N            1   2019/9/30     0:05:06  \n",
       "151        N            2   2019/11/5     0:05:07  \n",
       "154        N            2  2019/10/15     0:03:47  \n",
       "163        N            2  2019/12/20     0:03:50  \n",
       "168      NaN            2   2019/9/14     0:04:26  \n",
       "169        Y            1  2019/10/12     0:03:39  \n",
       "175        N            3    2020/1/8     0:03:48  \n",
       "176      NaN            2  2019/11/15     0:04:57  \n",
       "180        N            3  2019/10/28     0:03:42  \n",
       "191        N            2    2019/9/3     0:04:45  \n",
       "196        N            3   2019/9/22     0:04:03  "
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_Tsinghua_Female = df.query('School == \"Tsinghua University\" and Gender == \"Female\" ')\n",
    "df_Tsinghua_Female"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "id": "66c9e50c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "School               Grade      Name             Gender  Height  Weight  Transfer  Test_Number  Test_Date   Time_Record\n",
       "Tsinghua University  Freshman   Changli Zhang    Female  163.0   48.0    N         1            2020/1/5    0:05:13        1\n",
       "                     Senior     Xiaomei Zhou     Female  165.3   57.0    N         1            2019/12/29  0:05:25        1\n",
       "                     Junior     Xiaoquan Lv      Female  153.2   43.0    N         2            2019/9/16   0:04:49        1\n",
       "                                Yanli Zhang      Female  160.6   47.0    N         2            2019/10/24  0:03:49        1\n",
       "                     Senior     Juan You         Female  154.0   40.0    N         1            2019/11/12  0:03:40        1\n",
       "                                Juan Zhao        Female  161.2   47.0    N         1            2019/9/28   0:04:34        1\n",
       "                                Li Xu            Female  161.5   53.0    N         2            2019/10/29  0:03:40        1\n",
       "                                Li Zhao          Female  160.9   50.0    N         3            2019/9/22   0:04:03        1\n",
       "                                Mei Zheng        Female  161.1   50.0    N         3            2019/10/28  0:03:42        1\n",
       "                                Xiaofeng Shi     Female  164.4   55.0    N         1            2019/11/19  0:03:33        1\n",
       "                                Xiaopeng Chu     Female  156.5   42.0    N         1            2019/11/19  0:04:59        1\n",
       "                     Freshman   Chengquan Chu    Female  161.3   47.0    N         1            2019/12/10  0:05:02        1\n",
       "                     Senior     Yanli Zhang      Female  154.2   41.0    N         3            2020/1/8    0:03:48        1\n",
       "                     Sophomore  Changjuan You    Female  150.5   40.0    N         3            2020/1/5    0:04:52        1\n",
       "                                Chengli You      Female  164.1   57.0    N         1            2020/1/8    0:04:39        1\n",
       "                                Chengquan Zhang  Female  168.9   54.0    N         1            2019/12/7   0:04:29        1\n",
       "                                Feng Qian        Female  156.4   43.0    N         2            2019/11/5   0:05:07        1\n",
       "                                Qiang Sun        Female  154.3   40.0    N         1            2019/12/30  0:04:37        1\n",
       "                                Qiang Zhou       Female  150.5   36.0    N         1            2019/11/4   0:04:27        1\n",
       "                                Xiaomei Shi      Female  157.9   47.0    N         1            2019/11/30  0:04:09        1\n",
       "                     Junior     Xiaofeng You     Female  158.5   45.0    N         2            2019/12/30  0:05:09        1\n",
       "                                Qiang Sun        Female  163.1   53.0    N         1            2019/12/11  0:05:08        1\n",
       "                                Li Sun           Female  166.6   54.0    N         2            2019/9/3    0:04:45        1\n",
       "                                Gaoquan Shen     Female  158.0   51.0    N         2            2019/12/20  0:03:50        1\n",
       "                     Freshman   Feng Yang        Female  158.9   44.0    N         1            2019/9/17   0:05:11        1\n",
       "                                Gaoli Feng       Female  157.4   46.0    Y         1            2019/12/30  0:04:00        1\n",
       "                                Gaoquan Sun      Female  156.8   42.0    N         2            2019/11/9   0:05:18        1\n",
       "                                Juan Zhang       Female  168.6   55.0    N         1            2019/9/30   0:05:06        1\n",
       "                                Li Lv            Female  155.2   44.0    N         2            2019/9/28   0:05:27        1\n",
       "                                Li Wu            Female  164.3   51.0    N         1            2019/10/21  0:04:32        1\n",
       "                                Peng Wu          Female  162.5   53.0    N         2            2019/9/14   0:04:48        1\n",
       "                                Qiang Han        Female  151.8   38.0    N         2            2019/11/24  0:03:37        1\n",
       "                                Xiaoli Qian      Female  158.0   51.0    N         1            2019/10/31  0:03:47        1\n",
       "                                Xiaoli Xu        Female  156.5   43.0    N         1            2019/9/7    0:04:41        1\n",
       "                                Yanjuan Han      Female  163.7   49.0    N         3            2019/11/5   0:04:39        1\n",
       "                                Yanli Zhang      Female  165.1   52.0    N         1            2019/9/13   0:05:05        1\n",
       "                                Yanqiang Feng    Female  162.3   51.0    N         1            2019/12/10  0:04:13        1\n",
       "                     Junior     Changjuan Xu     Female  159.6   49.0    N         1            2019/11/2   0:03:55        1\n",
       "                                Chengquan Qin    Female  160.7   52.0    Y         1            2019/10/12  0:03:39        1\n",
       "                                Chengquan Shi    Female  160.8   51.0    N         2            2019/9/22   0:04:14        1\n",
       "                                Gaoqiang Qian    Female  161.9   50.0    N         1            2019/9/3    0:03:45        1\n",
       "                     Sophomore  Xiaoqiang Qin    Female  160.8   54.0    N         1            2019/12/6   0:05:26        1\n",
       "dtype: int64"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_Tsinghua_Female.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "211b2eea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Qiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.5</td>\n",
       "      <td>52.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/12</td>\n",
       "      <td>0:03:53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaopeng Zhou</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.1</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/29</td>\n",
       "      <td>0:05:16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Peng You</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>48.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/20</td>\n",
       "      <td>0:04:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Yanfeng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.1</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/19</td>\n",
       "      <td>0:05:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.4</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/30</td>\n",
       "      <td>0:03:36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.0</td>\n",
       "      <td>62.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/2</td>\n",
       "      <td>0:04:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changqiang Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>166.1</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/29</td>\n",
       "      <td>0:05:01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Zheng</td>\n",
       "      <td>Male</td>\n",
       "      <td>183.9</td>\n",
       "      <td>87.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/5</td>\n",
       "      <td>0:04:59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Feng Zheng</td>\n",
       "      <td>Female</td>\n",
       "      <td>165.6</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/20</td>\n",
       "      <td>0:05:23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Mei Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.5</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/13</td>\n",
       "      <td>0:04:38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaoli Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>171.4</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/20</td>\n",
       "      <td>0:05:12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Qiang Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>152.1</td>\n",
       "      <td>42.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/3</td>\n",
       "      <td>0:05:21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.5</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/22</td>\n",
       "      <td>0:05:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Yanpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>65.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/17</td>\n",
       "      <td>0:04:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>64</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Yanmei Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>167.7</td>\n",
       "      <td>57.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/16</td>\n",
       "      <td>0:03:37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>65</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaoli Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.9</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/10/14</td>\n",
       "      <td>0:05:12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Feng Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>183.4</td>\n",
       "      <td>82.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/25</td>\n",
       "      <td>0:05:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changmei Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>155.3</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Li Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>165.2</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/15</td>\n",
       "      <td>0:04:44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>167.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/15</td>\n",
       "      <td>0:03:43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaojuan Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.5</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/22</td>\n",
       "      <td>0:03:46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Feng Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.0</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/13</td>\n",
       "      <td>0:05:17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Chen</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/3</td>\n",
       "      <td>0:04:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.4</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/3</td>\n",
       "      <td>0:05:07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>109</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.1</td>\n",
       "      <td>56.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/9</td>\n",
       "      <td>0:04:28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>114</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaopeng Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.0</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/25</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>115</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaofeng Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.8</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/26</td>\n",
       "      <td>0:04:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Chunli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>180.2</td>\n",
       "      <td>83.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Peng Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>163.1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/23</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>121</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaoquan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.6</td>\n",
       "      <td>40.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/11/12</td>\n",
       "      <td>0:04:05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>122</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Qiang Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/7</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>123</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>152.9</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/30</td>\n",
       "      <td>0:04:23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>134</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaoli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>186.5</td>\n",
       "      <td>83.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/7</td>\n",
       "      <td>0:04:14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>141</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Chunmei Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.9</td>\n",
       "      <td>52.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/8</td>\n",
       "      <td>0:03:33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaoli Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>145.4</td>\n",
       "      <td>34.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/13</td>\n",
       "      <td>0:03:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaomei Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.3</td>\n",
       "      <td>49.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/17</td>\n",
       "      <td>0:04:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaofeng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.5</td>\n",
       "      <td>49.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/19</td>\n",
       "      <td>0:05:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>153</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changmei Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>172.2</td>\n",
       "      <td>75.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/6</td>\n",
       "      <td>0:04:15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>155</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chunmei Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.2</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/8</td>\n",
       "      <td>0:04:50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>156</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Juan Qin</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>161</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Quan Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/26</td>\n",
       "      <td>0:05:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>164</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Qiang Wang</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.5</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/11</td>\n",
       "      <td>0:04:44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.1</td>\n",
       "      <td>69.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/24</td>\n",
       "      <td>0:05:19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.3</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/28</td>\n",
       "      <td>0:04:02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>167</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaoqiang Feng</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.0</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/30</td>\n",
       "      <td>0:03:45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaofeng Zhang</td>\n",
       "      <td>Male</td>\n",
       "      <td>176.4</td>\n",
       "      <td>80.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/25</td>\n",
       "      <td>0:05:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>172</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Quan Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.6</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/4</td>\n",
       "      <td>0:03:45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>174</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaopeng Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.9</td>\n",
       "      <td>54.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/4</td>\n",
       "      <td>0:05:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>184</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Qiang Feng</td>\n",
       "      <td>Male</td>\n",
       "      <td>178.9</td>\n",
       "      <td>80.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/6</td>\n",
       "      <td>0:04:23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>188</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaopeng Shen</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.1</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/16</td>\n",
       "      <td>0:03:33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>190</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Changli Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>177.3</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/21</td>\n",
       "      <td>0:03:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>192</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaojuan Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.8</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/23</td>\n",
       "      <td>0:03:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "0    Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "2    Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "6    Shanghai Jiao Tong University   Freshman       Qiang Chu  Female   162.5   \n",
       "10   Shanghai Jiao Tong University   Freshman   Xiaopeng Zhou    Male   174.1   \n",
       "12   Shanghai Jiao Tong University     Senior        Peng You  Female     NaN   \n",
       "13   Shanghai Jiao Tong University  Sophomore    Yanfeng Qian  Female   160.1   \n",
       "19   Shanghai Jiao Tong University     Senior       Qiang Chu  Female   162.4   \n",
       "21   Shanghai Jiao Tong University     Senior   Xiaopeng Shen    Male   166.0   \n",
       "22   Shanghai Jiao Tong University     Senior  Changqiang Sun  Female   166.1   \n",
       "23   Shanghai Jiao Tong University     Senior     Qiang Zheng    Male   183.9   \n",
       "31   Shanghai Jiao Tong University     Junior      Feng Zheng  Female   165.6   \n",
       "42   Shanghai Jiao Tong University     Junior       Mei Zhang  Female   156.5   \n",
       "50   Shanghai Jiao Tong University     Junior     Xiaoli Wang    Male   171.4   \n",
       "56   Shanghai Jiao Tong University     Junior        Qiang Lv  Female   152.1   \n",
       "58   Shanghai Jiao Tong University     Junior         Mei Sun  Female   159.5   \n",
       "60   Shanghai Jiao Tong University   Freshman      Yanpeng Lv    Male     NaN   \n",
       "64   Shanghai Jiao Tong University     Junior     Yanmei Yang  Female   167.7   \n",
       "65   Shanghai Jiao Tong University  Sophomore        Gaoli Xu  Female   164.9   \n",
       "71   Shanghai Jiao Tong University  Sophomore        Feng Han    Male   183.4   \n",
       "79   Shanghai Jiao Tong University     Senior    Changmei Sun  Female   155.3   \n",
       "85   Shanghai Jiao Tong University     Junior          Li Chu  Female   165.2   \n",
       "87   Shanghai Jiao Tong University     Senior       Feng Yang  Female   167.0   \n",
       "89   Shanghai Jiao Tong University     Senior    Gaojuan Zhao  Female   151.5   \n",
       "93   Shanghai Jiao Tong University     Junior       Feng Zhao  Female   159.0   \n",
       "103  Shanghai Jiao Tong University     Senior        Mei Chen  Female   153.6   \n",
       "104  Shanghai Jiao Tong University     Senior     Xiaopeng Lv  Female   158.4   \n",
       "109  Shanghai Jiao Tong University     Senior     Chunpeng Lv  Female   164.1   \n",
       "114  Shanghai Jiao Tong University   Freshman   Xiaopeng Zhao  Female   161.0   \n",
       "115  Shanghai Jiao Tong University     Junior     Gaofeng Sun  Female   162.8   \n",
       "117  Shanghai Jiao Tong University   Freshman     Chunli Zhao    Male   180.2   \n",
       "119  Shanghai Jiao Tong University   Freshman      Peng Zhang  Female   163.1   \n",
       "121  Shanghai Jiao Tong University   Freshman    Xiaoquan Sun  Female   154.6   \n",
       "122  Shanghai Jiao Tong University     Junior       Qiang Sun  Female   160.8   \n",
       "123  Shanghai Jiao Tong University     Senior       Qiang Shi  Female   157.7   \n",
       "124  Shanghai Jiao Tong University  Sophomore    Chunpeng Shi  Female   152.9   \n",
       "134  Shanghai Jiao Tong University     Senior      Gaoli Zhao    Male   186.5   \n",
       "141  Shanghai Jiao Tong University   Freshman     Chunmei Shi  Female   164.9   \n",
       "143  Shanghai Jiao Tong University     Junior      Xiaoli Chu  Female   145.4   \n",
       "148  Shanghai Jiao Tong University   Freshman    Xiaomei Yang  Female   159.3   \n",
       "149  Shanghai Jiao Tong University   Freshman   Xiaofeng Qian  Female   158.5   \n",
       "153  Shanghai Jiao Tong University   Freshman     Changmei Lv    Male   172.2   \n",
       "155  Shanghai Jiao Tong University     Junior     Chunmei Han  Female   153.2   \n",
       "156  Shanghai Jiao Tong University     Senior        Juan Qin  Female   156.0   \n",
       "161  Shanghai Jiao Tong University     Senior       Quan Qian  Female   159.0   \n",
       "164  Shanghai Jiao Tong University     Junior      Qiang Wang  Female   157.5   \n",
       "165  Shanghai Jiao Tong University     Senior        Feng Han    Male   170.1   \n",
       "166  Shanghai Jiao Tong University     Senior   Xiaopeng Qian  Female   154.3   \n",
       "167  Shanghai Jiao Tong University  Sophomore  Xiaoqiang Feng  Female   157.0   \n",
       "171  Shanghai Jiao Tong University     Senior  Xiaofeng Zhang    Male   176.4   \n",
       "172  Shanghai Jiao Tong University     Junior       Quan Zhao  Female   160.6   \n",
       "174  Shanghai Jiao Tong University     Junior    Xiaopeng Sun  Female   161.9   \n",
       "184  Shanghai Jiao Tong University   Freshman      Qiang Feng    Male   178.9   \n",
       "188  Shanghai Jiao Tong University     Junior   Xiaopeng Shen  Female   160.1   \n",
       "190  Shanghai Jiao Tong University     Junior     Changli Qin    Male   177.3   \n",
       "192  Shanghai Jiao Tong University     Senior    Gaojuan Wang    Male   166.8   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "0      46.0        N            1   2019/10/5     0:04:34  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "6      52.0        N            1  2019/12/12     0:03:53  \n",
       "10     74.0        N            1   2019/9/29     0:05:16  \n",
       "12     48.0      NaN            2  2019/10/20     0:04:10  \n",
       "13     48.0        N            2   2019/9/19     0:05:29  \n",
       "19     50.0        N            3   2019/9/30     0:03:36  \n",
       "21     62.0      NaN            1    2020/1/2     0:04:54  \n",
       "22     55.0        N            1  2019/11/29     0:05:01  \n",
       "23     87.0        N            1   2019/12/5     0:04:59  \n",
       "31     51.0        N            1  2019/12/20     0:05:23  \n",
       "42     44.0        N            1   2019/9/13     0:04:38  \n",
       "50     70.0        N            3  2019/12/20     0:05:12  \n",
       "56     42.0        N            2   2019/11/3     0:05:21  \n",
       "58     50.0        N            1  2019/11/22     0:05:20  \n",
       "60     65.0        N            1  2019/11/17     0:04:13  \n",
       "64     57.0        N            2  2019/12/16     0:03:37  \n",
       "65     53.0        N            3  2019/10/14     0:05:12  \n",
       "71     82.0        N            2  2019/10/25     0:05:10  \n",
       "79     46.0        N            3   2019/12/9     0:05:13  \n",
       "85     51.0        N            2  2019/10/15     0:04:44  \n",
       "87     52.0      NaN            2  2019/10/15     0:03:43  \n",
       "89     44.0        N            1  2019/11/22     0:03:46  \n",
       "93     51.0        N            3  2019/12/13     0:05:17  \n",
       "103     NaN        N            2   2019/11/3     0:04:57  \n",
       "104    47.0        N            2   2019/10/3     0:05:07  \n",
       "109    56.0        N            1   2019/10/9     0:04:28  \n",
       "114    53.0        N            3   2019/9/25     0:05:13  \n",
       "115    48.0        N            2  2019/11/26     0:04:22  \n",
       "117    83.0        N            1    2020/1/7     0:04:33  \n",
       "119     NaN        N            3   2019/9/23     0:04:31  \n",
       "121    40.0        N            3  2019/11/12     0:04:05  \n",
       "122     NaN        N            1    2019/9/7     0:04:31  \n",
       "123     NaN      NaN            1   2019/12/9     0:05:22  \n",
       "124    44.0        N            1  2019/11/30     0:04:23  \n",
       "134    83.0        N            1    2019/9/7     0:04:14  \n",
       "141    52.0        N            1    2019/9/8     0:03:33  \n",
       "143    34.0        N            1  2019/11/13     0:03:56  \n",
       "148    49.0        N            1   2019/9/17     0:04:22  \n",
       "149    49.0        N            1  2019/10/19     0:05:26  \n",
       "153    75.0        N            1   2019/10/6     0:04:15  \n",
       "155    44.0        N            2   2019/11/8     0:04:50  \n",
       "156    47.0        N            1    2019/9/4     0:04:04  \n",
       "161    50.0        N            1   2019/9/26     0:05:26  \n",
       "164    48.0        N            3  2019/12/11     0:04:44  \n",
       "165    69.0        N            2   2019/9/24     0:05:19  \n",
       "166    46.0        N            3  2019/12/28     0:04:02  \n",
       "167    43.0        N            2  2019/11/30     0:03:45  \n",
       "171    80.0        N            1  2019/12/25     0:05:03  \n",
       "172    53.0        N            2   2019/10/4     0:03:45  \n",
       "174    54.0        N            2   2019/11/4     0:05:09  \n",
       "184    80.0        N            2   2019/12/6     0:04:23  \n",
       "188    53.0        N            1  2019/10/16     0:03:33  \n",
       "190     NaN        N            1  2019/11/21     0:03:57  \n",
       "192    70.0        N            1  2019/12/23     0:03:54  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  "
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_JT = df.query('School == \"Shanghai Jiao Tong University\" ')\n",
    "df_JT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "58662b4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "188.9"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_JT['Height'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "393624cb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Peng You</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>48.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/20</td>\n",
       "      <td>0:04:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.4</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/30</td>\n",
       "      <td>0:03:36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.0</td>\n",
       "      <td>62.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/2</td>\n",
       "      <td>0:04:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changqiang Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>166.1</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/29</td>\n",
       "      <td>0:05:01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Zheng</td>\n",
       "      <td>Male</td>\n",
       "      <td>183.9</td>\n",
       "      <td>87.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/5</td>\n",
       "      <td>0:04:59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changmei Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>155.3</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>167.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/15</td>\n",
       "      <td>0:03:43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaojuan Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.5</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/22</td>\n",
       "      <td>0:03:46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Chen</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/3</td>\n",
       "      <td>0:04:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.4</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/3</td>\n",
       "      <td>0:05:07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>109</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.1</td>\n",
       "      <td>56.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/9</td>\n",
       "      <td>0:04:28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>123</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>134</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaoli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>186.5</td>\n",
       "      <td>83.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/7</td>\n",
       "      <td>0:04:14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>156</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Juan Qin</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>161</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Quan Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/26</td>\n",
       "      <td>0:05:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.1</td>\n",
       "      <td>69.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/24</td>\n",
       "      <td>0:05:19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.3</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/28</td>\n",
       "      <td>0:04:02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaofeng Zhang</td>\n",
       "      <td>Male</td>\n",
       "      <td>176.4</td>\n",
       "      <td>80.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/25</td>\n",
       "      <td>0:05:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>192</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaojuan Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.8</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/23</td>\n",
       "      <td>0:03:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School   Grade            Name  Gender  Height  \\\n",
       "2    Shanghai Jiao Tong University  Senior         Mei Sun    Male   188.9   \n",
       "12   Shanghai Jiao Tong University  Senior        Peng You  Female     NaN   \n",
       "19   Shanghai Jiao Tong University  Senior       Qiang Chu  Female   162.4   \n",
       "21   Shanghai Jiao Tong University  Senior   Xiaopeng Shen    Male   166.0   \n",
       "22   Shanghai Jiao Tong University  Senior  Changqiang Sun  Female   166.1   \n",
       "23   Shanghai Jiao Tong University  Senior     Qiang Zheng    Male   183.9   \n",
       "79   Shanghai Jiao Tong University  Senior    Changmei Sun  Female   155.3   \n",
       "87   Shanghai Jiao Tong University  Senior       Feng Yang  Female   167.0   \n",
       "89   Shanghai Jiao Tong University  Senior    Gaojuan Zhao  Female   151.5   \n",
       "103  Shanghai Jiao Tong University  Senior        Mei Chen  Female   153.6   \n",
       "104  Shanghai Jiao Tong University  Senior     Xiaopeng Lv  Female   158.4   \n",
       "109  Shanghai Jiao Tong University  Senior     Chunpeng Lv  Female   164.1   \n",
       "123  Shanghai Jiao Tong University  Senior       Qiang Shi  Female   157.7   \n",
       "134  Shanghai Jiao Tong University  Senior      Gaoli Zhao    Male   186.5   \n",
       "156  Shanghai Jiao Tong University  Senior        Juan Qin  Female   156.0   \n",
       "161  Shanghai Jiao Tong University  Senior       Quan Qian  Female   159.0   \n",
       "165  Shanghai Jiao Tong University  Senior        Feng Han    Male   170.1   \n",
       "166  Shanghai Jiao Tong University  Senior   Xiaopeng Qian  Female   154.3   \n",
       "171  Shanghai Jiao Tong University  Senior  Xiaofeng Zhang    Male   176.4   \n",
       "192  Shanghai Jiao Tong University  Senior    Gaojuan Wang    Male   166.8   \n",
       "197  Shanghai Jiao Tong University  Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University  Senior   Chengmei Shen    Male   175.3   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "12     48.0      NaN            2  2019/10/20     0:04:10  \n",
       "19     50.0        N            3   2019/9/30     0:03:36  \n",
       "21     62.0      NaN            1    2020/1/2     0:04:54  \n",
       "22     55.0        N            1  2019/11/29     0:05:01  \n",
       "23     87.0        N            1   2019/12/5     0:04:59  \n",
       "79     46.0        N            3   2019/12/9     0:05:13  \n",
       "87     52.0      NaN            2  2019/10/15     0:03:43  \n",
       "89     44.0        N            1  2019/11/22     0:03:46  \n",
       "103     NaN        N            2   2019/11/3     0:04:57  \n",
       "104    47.0        N            2   2019/10/3     0:05:07  \n",
       "109    56.0        N            1   2019/10/9     0:04:28  \n",
       "123     NaN      NaN            1   2019/12/9     0:05:22  \n",
       "134    83.0        N            1    2019/9/7     0:04:14  \n",
       "156    47.0        N            1    2019/9/4     0:04:04  \n",
       "161    50.0        N            1   2019/9/26     0:05:26  \n",
       "165    69.0        N            2   2019/9/24     0:05:19  \n",
       "166    46.0        N            3  2019/12/28     0:04:02  \n",
       "171    80.0        N            1  2019/12/25     0:05:03  \n",
       "192    70.0        N            1  2019/12/23     0:03:54  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  "
      ]
     },
     "execution_count": 119,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_JT_Grade = df.query('School == \"Shanghai Jiao Tong University\" and Grade == \"Senior\" ')\n",
    "df_JT_Grade"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "id": "107978a6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Peng You</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>48.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/20</td>\n",
       "      <td>0:04:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.4</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/30</td>\n",
       "      <td>0:03:36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.0</td>\n",
       "      <td>62.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/2</td>\n",
       "      <td>0:04:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changqiang Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>166.1</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/29</td>\n",
       "      <td>0:05:01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Zheng</td>\n",
       "      <td>Male</td>\n",
       "      <td>183.9</td>\n",
       "      <td>87.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/5</td>\n",
       "      <td>0:04:59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changmei Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>155.3</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>167.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/15</td>\n",
       "      <td>0:03:43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaojuan Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.5</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/22</td>\n",
       "      <td>0:03:46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Chen</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/3</td>\n",
       "      <td>0:04:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.4</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/3</td>\n",
       "      <td>0:05:07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>109</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.1</td>\n",
       "      <td>56.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/9</td>\n",
       "      <td>0:04:28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>123</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Qiang Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>134</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaoli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>186.5</td>\n",
       "      <td>83.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/7</td>\n",
       "      <td>0:04:14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>156</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Juan Qin</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>161</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Quan Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/26</td>\n",
       "      <td>0:05:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>170.1</td>\n",
       "      <td>69.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/24</td>\n",
       "      <td>0:05:19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaopeng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.3</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/28</td>\n",
       "      <td>0:04:02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Xiaofeng Zhang</td>\n",
       "      <td>Male</td>\n",
       "      <td>176.4</td>\n",
       "      <td>80.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/25</td>\n",
       "      <td>0:05:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>192</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Gaojuan Wang</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.8</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/23</td>\n",
       "      <td>0:03:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School   Grade            Name  Gender  Height  \\\n",
       "2    Shanghai Jiao Tong University  Senior         Mei Sun    Male   188.9   \n",
       "12   Shanghai Jiao Tong University  Senior        Peng You  Female     NaN   \n",
       "19   Shanghai Jiao Tong University  Senior       Qiang Chu  Female   162.4   \n",
       "21   Shanghai Jiao Tong University  Senior   Xiaopeng Shen    Male   166.0   \n",
       "22   Shanghai Jiao Tong University  Senior  Changqiang Sun  Female   166.1   \n",
       "23   Shanghai Jiao Tong University  Senior     Qiang Zheng    Male   183.9   \n",
       "79   Shanghai Jiao Tong University  Senior    Changmei Sun  Female   155.3   \n",
       "87   Shanghai Jiao Tong University  Senior       Feng Yang  Female   167.0   \n",
       "89   Shanghai Jiao Tong University  Senior    Gaojuan Zhao  Female   151.5   \n",
       "103  Shanghai Jiao Tong University  Senior        Mei Chen  Female   153.6   \n",
       "104  Shanghai Jiao Tong University  Senior     Xiaopeng Lv  Female   158.4   \n",
       "109  Shanghai Jiao Tong University  Senior     Chunpeng Lv  Female   164.1   \n",
       "123  Shanghai Jiao Tong University  Senior       Qiang Shi  Female   157.7   \n",
       "134  Shanghai Jiao Tong University  Senior      Gaoli Zhao    Male   186.5   \n",
       "156  Shanghai Jiao Tong University  Senior        Juan Qin  Female   156.0   \n",
       "161  Shanghai Jiao Tong University  Senior       Quan Qian  Female   159.0   \n",
       "165  Shanghai Jiao Tong University  Senior        Feng Han    Male   170.1   \n",
       "166  Shanghai Jiao Tong University  Senior   Xiaopeng Qian  Female   154.3   \n",
       "171  Shanghai Jiao Tong University  Senior  Xiaofeng Zhang    Male   176.4   \n",
       "192  Shanghai Jiao Tong University  Senior    Gaojuan Wang    Male   166.8   \n",
       "197  Shanghai Jiao Tong University  Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University  Senior   Chengmei Shen    Male   175.3   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "12     48.0      NaN            2  2019/10/20     0:04:10  \n",
       "19     50.0        N            3   2019/9/30     0:03:36  \n",
       "21     62.0      NaN            1    2020/1/2     0:04:54  \n",
       "22     55.0        N            1  2019/11/29     0:05:01  \n",
       "23     87.0        N            1   2019/12/5     0:04:59  \n",
       "79     46.0        N            3   2019/12/9     0:05:13  \n",
       "87     52.0      NaN            2  2019/10/15     0:03:43  \n",
       "89     44.0        N            1  2019/11/22     0:03:46  \n",
       "103     NaN        N            2   2019/11/3     0:04:57  \n",
       "104    47.0        N            2   2019/10/3     0:05:07  \n",
       "109    56.0        N            1   2019/10/9     0:04:28  \n",
       "123     NaN      NaN            1   2019/12/9     0:05:22  \n",
       "134    83.0        N            1    2019/9/7     0:04:14  \n",
       "156    47.0        N            1    2019/9/4     0:04:04  \n",
       "161    50.0        N            1   2019/9/26     0:05:26  \n",
       "165    69.0        N            2   2019/9/24     0:05:19  \n",
       "166    46.0        N            3  2019/12/28     0:04:02  \n",
       "171    80.0        N            1  2019/12/25     0:05:03  \n",
       "192    70.0        N            1  2019/12/23     0:03:54  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  "
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_JT_Grade = df.query('School == \"Shanghai Jiao Tong University\" and Grade == \"Senior\" ')\n",
    "df_JT_Grade"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "118d3233",
   "metadata": {},
   "source": [
    "## Groupby"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "id": "6283dbb0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>School</th>\n",
       "      <th>Gender</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Fudan University</th>\n",
       "      <th>Female</th>\n",
       "      <td>158.776923</td>\n",
       "      <td>47.900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>174.212500</td>\n",
       "      <td>72.300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Peking University</th>\n",
       "      <th>Female</th>\n",
       "      <td>158.666667</td>\n",
       "      <td>46.650000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>172.030000</td>\n",
       "      <td>73.700000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Shanghai Jiao Tong University</th>\n",
       "      <th>Female</th>\n",
       "      <td>159.122500</td>\n",
       "      <td>48.513514</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>176.760000</td>\n",
       "      <td>76.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Tsinghua University</th>\n",
       "      <th>Female</th>\n",
       "      <td>159.753333</td>\n",
       "      <td>48.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>171.638889</td>\n",
       "      <td>69.947368</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                          Height     Weight\n",
       "School                        Gender                       \n",
       "Fudan University              Female  158.776923  47.900000\n",
       "                              Male    174.212500  72.300000\n",
       "Peking University             Female  158.666667  46.650000\n",
       "                              Male    172.030000  73.700000\n",
       "Shanghai Jiao Tong University Female  159.122500  48.513514\n",
       "                              Male    176.760000  76.000000\n",
       "Tsinghua University           Female  159.753333  48.000000\n",
       "                              Male    171.638889  69.947368"
      ]
     },
     "execution_count": 121,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(['School','Gender']).agg({'Height':'mean','Weight':'mean'})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a2fc2ae6",
   "metadata": {},
   "source": [
    "## 实践二"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "id": "e145038d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>排名</td>\n",
       "      <td>排名变化</td>\n",
       "      <td>企业名称</td>\n",
       "      <td>价值（亿元人民币）</td>\n",
       "      <td>价值变化（亿元人民币）</td>\n",
       "      <td>国家</td>\n",
       "      <td>城市</td>\n",
       "      <td>行业</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>102 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      0     1                    2          3            4   5      6     7\n",
       "0    排名  排名变化                 企业名称  价值（亿元人民币）  价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1     0                   抖音      13400       -10050  中国     北京  社交媒体\n",
       "2     2     1               SpaceX       8400         1680  美国    洛杉矶    航天\n",
       "3     3    -1                 蚂蚁集团       8000        -2010  中国     杭州  金融科技\n",
       "4     4     0               Stripe       4100        -2210  美国    旧金山  金融科技\n",
       "..   ..   ...                  ...        ...          ...  ..    ...   ...\n",
       "97   95   -16        Impossible 食品        470            0  美国  雷德伍德城  食品饮料\n",
       "98   95   -16                   微医        470            0  中国     杭州  健康科技\n",
       "99   99    58                 蜂巢能源        460          190  中国     常州   新能源\n",
       "100  99    -6           Better.com        460           60  美国     纽约  金融科技\n",
       "101  99   -20  Automation Anywhere        460          -10  美国    圣何塞  人工智能\n",
       "\n",
       "[102 rows x 8 columns]"
      ]
     },
     "execution_count": 122,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hurun_独角兽=pd.read_html('https://www.hurun.net/zh-CN/info/Detail?num=L9SQPH9FKJB1')[-3]\n",
    "hurun_独角兽"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "id": "11b54865",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['排名', '排名变化', '企业名称', '价值（亿元人民币）', '价值变化（亿元人民币）', '国家', '城市', '行业']"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hurun_独角兽[0:1].values.tolist()[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "id": "f42ab8fd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>101 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      0    1                    2      3       4   5      6     7\n",
       "1     1    0                   抖音  13400  -10050  中国     北京  社交媒体\n",
       "2     2    1               SpaceX   8400    1680  美国    洛杉矶    航天\n",
       "3     3   -1                 蚂蚁集团   8000   -2010  中国     杭州  金融科技\n",
       "4     4    0               Stripe   4100   -2210  美国    旧金山  金融科技\n",
       "5     5   11                Shein   4000    2680  中国     广州  电子商务\n",
       "..   ..  ...                  ...    ...     ...  ..    ...   ...\n",
       "97   95  -16        Impossible 食品    470       0  美国  雷德伍德城  食品饮料\n",
       "98   95  -16                   微医    470       0  中国     杭州  健康科技\n",
       "99   99   58                 蜂巢能源    460     190  中国     常州   新能源\n",
       "100  99   -6           Better.com    460      60  美国     纽约  金融科技\n",
       "101  99  -20  Automation Anywhere    460     -10  美国    圣何塞  人工智能\n",
       "\n",
       "[101 rows x 8 columns]"
      ]
     },
     "execution_count": 124,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun = hurun_独角兽[1:]\n",
    "df_hurun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "id": "8f41bd41",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>排名变化</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>价值（亿元人民币）</th>\n",
       "      <th>价值变化（亿元人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>101 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     排名 排名变化                 企业名称 价值（亿元人民币） 价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1    0                   抖音     13400      -10050  中国     北京  社交媒体\n",
       "2     2    1               SpaceX      8400        1680  美国    洛杉矶    航天\n",
       "3     3   -1                 蚂蚁集团      8000       -2010  中国     杭州  金融科技\n",
       "4     4    0               Stripe      4100       -2210  美国    旧金山  金融科技\n",
       "5     5   11                Shein      4000        2680  中国     广州  电子商务\n",
       "..   ..  ...                  ...       ...         ...  ..    ...   ...\n",
       "97   95  -16        Impossible 食品       470           0  美国  雷德伍德城  食品饮料\n",
       "98   95  -16                   微医       470           0  中国     杭州  健康科技\n",
       "99   99   58                 蜂巢能源       460         190  中国     常州   新能源\n",
       "100  99   -6           Better.com       460          60  美国     纽约  金融科技\n",
       "101  99  -20  Automation Anywhere       460         -10  美国    圣何塞  人工智能\n",
       "\n",
       "[101 rows x 8 columns]"
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.columns = hurun_独角兽[0:1].values.tolist()[0]\n",
    "df_hurun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "9be2dbb1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 101 entries, 1 to 101\n",
      "Data columns (total 8 columns):\n",
      " #   Column       Non-Null Count  Dtype \n",
      "---  ------       --------------  ----- \n",
      " 0   排名           101 non-null    object\n",
      " 1   排名变化         101 non-null    object\n",
      " 2   企业名称         101 non-null    object\n",
      " 3   价值（亿元人民币）    101 non-null    object\n",
      " 4   价值变化（亿元人民币）  101 non-null    object\n",
      " 5   国家           101 non-null    object\n",
      " 6   城市           101 non-null    object\n",
      " 7   行业           101 non-null    object\n",
      "dtypes: object(8)\n",
      "memory usage: 6.4+ KB\n"
     ]
    }
   ],
   "source": [
    "df_hurun.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "id": "44ac9df1",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\86130\\AppData\\Local\\Temp\\ipykernel_46160\\543701024.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_hurun['价值（亿元人民币）'] = df_hurun['价值（亿元人民币）'].astype('int64')\n"
     ]
    }
   ],
   "source": [
    "df_hurun['价值（亿元人民币）'] = df_hurun['价值（亿元人民币）'].astype('int64')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "id": "fb57a00f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 101 entries, 1 to 101\n",
      "Data columns (total 8 columns):\n",
      " #   Column       Non-Null Count  Dtype \n",
      "---  ------       --------------  ----- \n",
      " 0   排名           101 non-null    object\n",
      " 1   排名变化         101 non-null    object\n",
      " 2   企业名称         101 non-null    object\n",
      " 3   价值（亿元人民币）    101 non-null    int64 \n",
      " 4   价值变化（亿元人民币）  101 non-null    object\n",
      " 5   国家           101 non-null    object\n",
      " 6   城市           101 non-null    object\n",
      " 7   行业           101 non-null    object\n",
      "dtypes: int64(1), object(7)\n",
      "memory usage: 6.4+ KB\n"
     ]
    }
   ],
   "source": [
    "df_hurun.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2611b9f2",
   "metadata": {},
   "source": [
    "* 有多少个国家？  \n",
    "* 有多少个城市？数量在地图上面用颜色的深浅表示出来。\n",
    "* 有多少个行业？\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "id": "af93567a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['中国', '美国', '马耳他', '英国', '澳大利亚', '印度', '瑞典', '印度尼西亚', '巴哈马', '土耳其',\n",
       "       '墨西哥', '瑞士', '韩国', '德国', '越南', '以色列'], dtype=object)"
      ]
     },
     "execution_count": 129,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['国家'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "id": "ee531adf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['北京', '洛杉矶', '杭州', '旧金山', '广州', '马耳他', '深圳', '伦敦', '悉尼', '芝加哥',\n",
       "       '班加罗尔', '哥德堡', '雅加达', '上海', '拿索', 'Novi', '费城', '香港', '沃尔瑟姆',\n",
       "       '伊斯坦布尔', '圣迭戈', '斯德哥尔摩', '纽约', 'Kebayoran Baru', '长沙', '无锡', '常州',\n",
       "       '爱莫利维尔', '宁波', '墨西哥城', 'Zug', '首尔', '圣何塞', '慕尼黑', '胡志明市', '内坦亚',\n",
       "       '孟买', '宿迁', '哈里斯堡', '帕洛阿尔托', '波士顿', '格兰岱尔市', '古尔冈', '雷德伍德城'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 130,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['城市'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "id": "3a6f00ee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['社交媒体', '航天', '金融科技', '电子商务', '区块链', '大数据', '数字科技', '物流', '软件服务',\n",
       "       '教育科技', '新能源汽车', '快递', '机器人', '企业服务', '健康科技', '共享经济', '食品饮料',\n",
       "       '人工智能', '生物科技', '新能源', '保险', '新零售', '游戏', '网络安全', '分析', '消费品'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 131,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['行业'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "id": "096a370e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "美国       49\n",
       "中国       26\n",
       "英国        7\n",
       "印度        4\n",
       "瑞典        2\n",
       "印度尼西亚     2\n",
       "韩国        2\n",
       "马耳他       1\n",
       "澳大利亚      1\n",
       "巴哈马       1\n",
       "土耳其       1\n",
       "墨西哥       1\n",
       "瑞士        1\n",
       "德国        1\n",
       "越南        1\n",
       "以色列       1\n",
       "Name: 国家, dtype: int64"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['国家'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "aa3d84be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "金融科技     17\n",
       "软件服务     14\n",
       "区块链       9\n",
       "电子商务      8\n",
       "人工智能      6\n",
       "物流        5\n",
       "共享经济      4\n",
       "新能源       4\n",
       "快递        4\n",
       "健康科技      4\n",
       "网络安全      3\n",
       "社交媒体      2\n",
       "游戏        2\n",
       "生物科技      2\n",
       "食品饮料      2\n",
       "企业服务      2\n",
       "机器人       2\n",
       "新能源汽车     2\n",
       "大数据       2\n",
       "航天        1\n",
       "教育科技      1\n",
       "保险        1\n",
       "新零售       1\n",
       "数字科技      1\n",
       "分析        1\n",
       "消费品       1\n",
       "Name: 行业, dtype: int64"
      ]
     },
     "execution_count": 133,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['行业'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "1676c15a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>价值（亿元人民币）</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">中国</th>\n",
       "      <th rowspan=\"3\" valign=\"top\">上海</th>\n",
       "      <th>健康科技</th>\n",
       "      <td>1040</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>670</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件服务</th>\n",
       "      <td>1300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">北京</th>\n",
       "      <th>保险</th>\n",
       "      <td>740</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>965</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>伦敦</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>4785</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>越南</th>\n",
       "      <th>胡志明市</th>\n",
       "      <th>消费品</th>\n",
       "      <td>550</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">韩国</th>\n",
       "      <th rowspan=\"2\" valign=\"top\">首尔</th>\n",
       "      <th>区块链</th>\n",
       "      <td>535</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>560</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <th>马耳他</th>\n",
       "      <th>区块链</th>\n",
       "      <td>3000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>82 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "               价值（亿元人民币）\n",
       "国家  城市   行业             \n",
       "中国  上海   健康科技       1040\n",
       "         电子商务        670\n",
       "         软件服务       1300\n",
       "    北京   保险          740\n",
       "         共享经济        965\n",
       "...                  ...\n",
       "英国  伦敦   金融科技       4785\n",
       "越南  胡志明市 消费品         550\n",
       "韩国  首尔   区块链         535\n",
       "         电子商务        560\n",
       "马耳他 马耳他  区块链        3000\n",
       "\n",
       "[82 rows x 1 columns]"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.groupby(['国家','城市','行业']).agg({'价值（亿元人民币）':'sum'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "60a703c1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
